Skip to content

Instantly share code, notes, and snippets.

@aristath
Created May 11, 2013 10:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aristath/5559583 to your computer and use it in GitHub Desktop.
Save aristath/5559583 to your computer and use it in GitHub Desktop.
<?php
// The current time in seconds since Unix Epoch
$current_time = date( 'U' );
// The post time in seconds since Unix Epoch
$post_time = get_the_time( 'U' );
// Calculate how many days ago the post was posted
$days_ago = round( ( $current_time - $post_time ) / ( 60*60*24 ) );
if ( $days_ago >= 60 ) {
// Do something if the post is older than 60 days
} else {
// Do something if the post is younger than 60 days
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment