Notify readers of old posts

Adding this to your wordpress theme within the loop will display a message to your visitors to notify them when a post is over a year old.

 

 

<?php
$time_defined_as_old = 60*60*24*365; // A Year
if((date('U')-get_the_time('U')) > $time_defined_as_old) {
echo '<div class="notice"><strong>Notice</strong><br />This article is published more than one year ago. Information in this article might be irrelevant with current situation</div>';
}
?>

Be Sociable, Share!

Leave a comment