How to Show a Post From Exactly One Year Ago Today
Development
There may be certain special occasions where you’d like to show a post from one year ago.
Perhaps you’d like to dedicate a portion of your sidebar or footer to show a post from exactly one year ago. Drop this snippet anywhere in your theme’s template files where you want the post to appear:
<?php
$current_day = date('j');
$last_year = date('Y')-1;
query_posts('day='.$current_day.'&year='.$last_year);
if (have_posts()):
while (have_posts()) : the_post();
the_title();
the_excerpt();
endwhile;
endif;
?>
Source: WP Recipes
Create your free account to post your comment
Login to post your comment