Created
October 14, 2012 05:27
-
-
Save leoken/3887489 to your computer and use it in GitHub Desktop.
Set An Expiration Time For WordPress Posts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| if (have_posts()) : | |
| while (have_posts()) : the_post(); ?> | |
| $expirationtime = get_post_custom_values('expiration'); | |
| if (is_array($expirationtime)) { | |
| $expirestring = implode($expirationtime); | |
| } | |
| $secondsbetween = strtotime($expirestring)-time(); | |
| if ( $secondsbetween > 0 ) { | |
| // For example... | |
| the_title(); | |
| the_excerpt(); | |
| } | |
| endwhile; | |
| endif; | |
| ?> |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://wp.smashingmagazine.com/2009/05/13/10-custom-fields-hacks-for-wordpress/