Codex tools: Log in / create account
Contents |
This function displays a date-based archives list. This tag can be used anywhere within a template.
<?php wp_get_archives( $args ); ?>
<?php $args = array(
'type' => 'monthly',
'limit' => ,
'format' => 'html',
'before' => ,
'after' => ,
'show_post_count' => false,
'echo' => 1 ); ?>
By default, the usage shows:
Displays archive list by month, displaying only the last twelve.
<?php wp_get_archives('type=monthly&limit=12'); ?>
Displays archive list by date, displaying only the last fifteen days.
<?php wp_get_archives('type=daily&limit=15'); ?>
Displays archive list of the last twenty most recent posts listed by post title.
<?php wp_get_archives('type=postbypost&limit=20&format=custom'); ?>
Displays a dropdown box of Monthly archives, in select tags, with the post count displayed.
<select name="archive-dropdown" onChange='document.location.href=this.options[this.selectedIndex].value;'>
<option value=""><?php echo attribute_escape(__('Select Month')); ?></option>
<?php wp_get_archives('type=monthly&format=option&show_post_count=1'); ?> </select>
Displays ALL posts alphabetically, especially if you want to have an archive that serves like a sitemap.
<?php wp_get_archives('type=alpha'); ?>
Since: 1.2.0
wp_get_archives() is located in wp-includes/general-template.php.
wp_list_authors, wp_list_categories, wp_list_pages, wp_list_bookmarks, wp_list_comments, wp_get_archives, wp_page_menu, wp_dropdown_pages, wp_dropdown_categories, wp_dropdown_users