creativeworldstudio
Member
Posted 4 years ago #
Hi everyone -
I'm trying to make the time stamps on my comments and entries more user friendly - the desired effect is virtually the same as this forum, where (for example) in each comment on a blog entry the time will be written "1 day 3hrs ago"...
I've searched around and have come across a few old techniques here, here and here.
Can anyone give some advice on how to get the desired effect?? Either plugin or hack.
Many thanks - Leon.
creativeworldstudio
Member
Posted 4 years ago #
any ideas or suggestions?
Moonwolf
Member
Posted 4 years ago #
Try this:
Posted <?php
if(function_exists('time_since')) {
$entry_datetime = abs(strtotime($post->post_date));
echo time_since($entry_datetime, time());
echo ' ago ';
} ?>
Moonwolf
Member
Posted 4 years ago #
I forgot, that's using Dunstan's Time Since plugin - http://binarybonsai.com/wordpress/time-since/
it works with 2.3 and 2.5
creativeworldstudio
Member
Posted 4 years ago #
Thank you Moonwolf! This worked for me.