Add inline HTML to posts published within last 24hrs

Compare the current time with the UNIX time stamp of the post date:

// now minus one day in seconds
if ( ( time() - 86400 ) < get_the_date( 'U' ) )
{
    echo '<span class="new">New!</span>';
}

Leave a Comment