/ Published in: PHP

All you need to do when writing the post, is enter a custom field with the key "expiration" and set the value in the format: "2010/01/01 18:20:00" - this would expire the post at 6.20pm on the 1st January 2010.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
***PUT THIS INSIDE THE LOOP, FIRST THING*** <?php //to check against expiration date; $expirationdate = get_post_custom_values('expiration'); $expirestring = '30005050235959'; //MAKE UN-EXPIRING POSTS ALWAYS SHOW UP; } else { } } //else if (( $expirestring > $currentdate ) || (is_archive())) { ?> ***THEN PUT THE FOLLOWING LINE AT THE VERY END OF THE LOOP*** <?php } //end if for expiration; ?>
Comments
