Show expired posts


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php //to check against expiration date;
  2. $timestamp = strtotime("now + 8 hours");
  3. $currentdate = date('YmdHis', $timestamp);
  4. $expirationdate = get_post_custom_values('expiration');
  5. if (is_null($expirationdate)) {
  6. $expirestring = '30005050235959'; //MAKE UN-EXPIRING POSTS ALWAYS SHOW UP;
  7. } else {
  8.  
  9. if (is_array($expirationdate)) {
  10. $expirestringarray = implode($expirationdate);
  11. }
  12. $markup = array("/",":"," ");
  13. $expirestring = str_replace($markup,"",$expirestringarray);
  14. } //else
  15. if (( $expirestring > $currentdate ) || (is_archive())) { ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.