Currently I have the following string.
$timeago = human_time_diff( get_the_time('U'), current_time('timestamp') );
print $timeago;
This returns results that looks like this.
1 min, 1 hour, 1 week, 1 month, and 1 year.
I am trying to figure out how I can make this work using an if
statement to detect if the post has been posted within the past 5 hours, and if it has make it echo "NEW" but if not, don't echo anything.
EDIT: I tried the following with no success... I am getting confused on how to make it check for the hours portion as well as the number portion I guess.
$timeago = human_time_diff( get_the_time('U'), current_time('timestamp') );
print $timeago;
if( $timeago >= 0 && $timeago <= 5 )
{
print 'NEW';
}