您可以创建日期。php(您可以从主题文件夹中的存档文件(archive.php)或索引文件(index.php)复制此文件的内容),主题文件夹将处理所有“day”页面。。。
<?php get_header(); ?>
<div id="container">
<div id="content" role="main">
<?php
$day = get_query_var(\'day\');
$monthnum = get_query_var(\'monthnum\');
$year = get_query_var(\'year\');
if ( is_day() ) : ?>
<a href="<?php echo get_day_link($year, $monthnum, $day-1); ?>">Previous day\'s posts</a> |
<a href="<?php echo get_day_link(); ?>">This day\'s posts</a>
<?php if ( mktime(0, 0, 0, $monthnum, $day, $year) < mktime(0, 0, 0) ) : ?>
| <a href="<?php echo get_day_link($year, $monthnum, $day+1); ?>">Next day\'s posts</a>
<?php endif; ?>
<?php elseif ( is_month() ) : ?>
<a href="<?php echo get_month_link($year, $monthnum-1); ?>">Previous month\'s posts</a> |
<a href="<?php echo get_month_link(); ?>">This month\'s posts</a>
<?php if ( mktime(0, 0, 0, $monthnum) < mktime(0, 0, 0) ) : ?>
| <a href="<?php echo get_month_link($year, $monthnum+1); ?>">Next month\'s posts</a>
<?php endif; ?>
<?php elseif ( is_year() ) : ?>
<a href="<?php echo get_year_link($year-1); ?>">Previous year\'s posts</a> |
<a href="<?php echo get_year_link(); ?>">This year\'s posts</a>
<?php if ( mktime(0, 0, 0, 0, 0, $year) < mktime(0, 0, 0, 0, 0) ) : ?>
| <a href="<?php echo get_year_link($year+1); ?>">Next year\'s posts</a>
<?php endif; ?>
<?php endif; ?>
<?php
/* Queue the first post, that way we know
* what date we\'re dealing with (if that is the case).
*
* We reset this later so we can run the loop
* properly with a call to rewind_posts().
*/
if ( have_posts() ) :
the_post();
?>
<h1 class="page-title">
<?php if ( is_day() ) : ?>
<?php printf( __( \'Daily Archives: <span>%s</span>\' ), get_the_date() ); ?>
<?php elseif ( is_month() ) : ?>
<?php printf( __( \'Monthly Archives: <span>%s</span>\' ), get_the_date( \'F Y\' ) ); ?>
<?php elseif ( is_year() ) : ?>
<?php printf( __( \'Yearly Archives: <span>%s</span>\' ), get_the_date( \'Y\' ) ); ?>
<?php else : ?>
<?php _e( \'Blog Archives\', \'twentyten\' ); ?>
<?php endif; ?>
</h1>
<?php endif; ?>
<?php
/* Since we called the_post() above, we need to
* rewind the loop back to the beginning that way
* we can run the loop properly, in full.
*/
rewind_posts();
/* Run the loop for the archives page to output the posts.
* If you want to overload this in a child theme then include a file
* called loop-archive.php and that will be used instead.
*/
if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( \'Permalink to %s\' ), the_title_attribute( \'echo=0\' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<div class="entry-summary">
<?php the_excerpt(); ?>
</div><!-- .entry-summary -->
<div class="entry-utility">
<?php if ( count( get_the_category() ) ) : ?>
<span class="cat-links">
<?php printf( __( \'<span class="%1$s">Posted in</span> %2$s\' ), \'entry-utility-prep entry-utility-prep-cat-links\', get_the_category_list( \', \' ) ); ?>
</span>
<span class="meta-sep">|</span>
<?php endif; ?>
<?php
$tags_list = get_the_tag_list( \'\', \', \' );
if ( $tags_list ):
?>
<span class="tag-links">
<?php printf( __( \'<span class="%1$s">Tagged</span> %2$s\' ), \'entry-utility-prep entry-utility-prep-tag-links\', $tags_list ); ?>
</span>
<span class="meta-sep">|</span>
<?php endif; ?>
<span class="comments-link"><?php comments_popup_link( __( \'Leave a comment\', \'twentyten\' ), __( \'1 Comment\' ), __( \'% Comments\' ) ); ?></span>
<?php edit_post_link( __( \'Edit\' ), \'<span class="meta-sep">|</span> <span class="edit-link">\', \'</span>\' ); ?>
</div><!-- .entry-utility -->
</div><!-- #post-## -->
<?php endwhile; ?>
<?php else : ?>
<h1 class="page-title">There are no posts for this date.</h1>
<?php endif; ?>
</div><!-- #content -->
</div><!-- #container -->
<?php get_sidebar(); ?>
此示例还可以处理“月”和“年”页面。
http://wptest.dev/2011/04/23/