Skip to content

Instantly share code, notes, and snippets.

@leoken
Created October 14, 2012 05:27
Show Gist options
  • Save leoken/3887489 to your computer and use it in GitHub Desktop.
Save leoken/3887489 to your computer and use it in GitHub Desktop.
Set An Expiration Time For WordPress Posts
<?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;
?>
@leoken
Copy link
Author

leoken commented Oct 14, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment