Archive queries

Here are some common use cases:source


The main call

The argument array

Parameters
type
(string) The type of archive list to display. Defaults to WordPress settings. Valid values:

  • yearly
  • monthly – Default
  • daily
  • weekly
  • postbypost (posts ordered by post date)
  • alpha (same as postbypost but posts are ordered by post title)

limit
(integer) Number of archives to get. Default is no limit.
format
(string) Format for the archive list. Valid values:

  • html – In HTML list (
  • ) tags and before and after strings. This is the default.
  • option – In select or dropdown option tags.
  • link – Within link tags.
  • custom – Custom list using the before and after strings.

before
(string) Text to place before the link when using the html or custom for format option. There is no default.
after
Text to place after the link when using the html or custom for format option. There is no default.
show_post_count
Display number of posts in an archive or do not. For use with all type except ‘postbypost’.

  • 1 (True)
  • 0 (False) – Default

echo
Display the output or return it.

  • 1 (True) – Default
  • 0 (False)

order
(string) How to order the link list (since Version 3.5)

  • ASC – Ascending order (A-Z).
  • DESC – Descending order (Z-A) – Default