This goes in the loop:
<?php
$days_old = (current_time(timestamp) - get_the_time('U') - (get_settings('gmt_offset') *3600 ) ) / (60*60*24);
if ($days_old <=1) {
echo 'Today';
} elseif ($days_old > 1 & $days_old <= 2) {
echo 'Yesterday';
} else {
the_time('F jS, Y');
}
?>
Nice, thank you
If I use the_date then will show just 1 time Today, and 1 time Yesterday?
I messed to say I want that atribute of the date, just to show one time the date value
I’m from germany and the time is not right for me. how can i change it to make it work for me? f.e.: posts from the late 22nd of september are shown as “today” on the 23rd… please help!
MichaelH: This code work perfect, except that it displays “Today” for the posts that been posted in 24 hours. I dont want that, I want the text “Today” if it were posted the same day, not the same 24 hours. Please someone help 🙂
Bump! I really need help. 🙂