Posted By

firewalker06 on 02/01/11


Tagged

php wordpress


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

rhainek


Notify of Old Post in WordPress


 / Published in: PHP
 

Benefit

To notify visitors that the current post they are viewing is an old post. Suitable for Blog / Website that provide timely articles

  1. <?php
  2. // Put inside Post Loop
  3.  
  4. $time_defined_as_old = 60*60*24*365; // A Year
  5.  
  6. if((date('U')-get_the_time('U')) > $time_defined_as_old) {
  7. 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>';
  8. }
  9.  
  10. ?>

Report this snippet  

You need to login to post a comment.