Created
May 11, 2013 10:36
-
-
Save aristath/5559583 to your computer and use it in GitHub Desktop.
This file contains 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 | |
// 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