Here’s a nice idea to give a second life to your old posts: This code display automatically the posts you published exactly one year ago.
Here’s a nice idea to give a second life to your old posts: This code display automatically the posts you published exactly one year ago.
To achieve this recipe, simply paste the following code where you want posts published exactly one year ago 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;
?>
15 Responses
Hmm, for some reason this makes loops following it fail to execute. No errors though…
@BabyGotMac: If you use two different loops, you might need to use the rewind_posts() function.
perfect recipe for aged blogs
Excellent recipe which makes for a delicious way to showcase posts from the archive via a specified time frame.
I will be able to use this from next on… when my blog becomes 1 year old.
Thanks for this great tip and idea !
ahem… I wanted to say “from next week on”, of course.
Trackbacks: