Codex tools: Log in / create account
This function has been deprecated. That means it has been replaced by a new function or is no longer supported, and may be removed from future versions. All code that uses this function should be converted to use its replacement if one exists.
Contents |
Displays a list of links to date-based archives. This tag can be used anywhere within a template. It is similar to wp_get_archives().
<?php get_archives('type', 'limit', 'format', 'before', 'after', show_post_count); ?>
Displays archive links using defaults.
<?php get_archives(); ?>
Displays all archives by month in an unordered list, with count of posts by month.
<ul>
<?php get_archives('monthly', '', 'html', '', '', TRUE); ?>
</ul>
Displays a non-bulleted list of the last 10 posts separated by line breaks.
<?php get_archives('postbypost', '10', 'custom', '', '<br />'); ?>
Displays monthly archives in a dropdown list; the use of javascript is required to have an archive selection open on the page.
<form id="archiveform" action="">
<select name="archive_chrono" onchange="window.location =
(document.forms.archiveform.archive_chrono[document.forms.archiveform.archive_chrono.selectedIndex].value);">
<option value=''>Select Month</option>
<?php get_archives('monthly','','option'); ?>
</select>
</form>
You also can use piece of code below, that works better than the example above. It shows the months list, including the number of posts/month.
<select name="archivemenu" onChange="document.location.href=this.options[this.selectedIndex].value;">
<option value="">Select month</option>
<?php get_archives('monthly',,'option',,,'TRUE'); ?>
</select>
Displays a custom number of recent posts in an unordered list.
<ul><?php get_archives('postbypost','10','custom','<li>','</li>'); ?></ul>
To use the query string to pass parameters to generate an archive list, see wp_get_archives()
bloginfo, bloginfo_rss, get_bloginfo, get_bloginfo_rss, wp_title, get_archives, wp_get_archives, get_calendar, get_posts, wp_list_pages, wp_dropdown_pages, wp_loginout, wp_register, query_posts, rss_enclosure