I found this snippet [//css-tricks.com/snippets/php/time-ago-function/](//css-tricks.com/snippets/php/time-ago-function/ “//css-tricks.com/snippets/php/time-ago-function/”) .
But I am not sure I can use it for WordPress…
I’m I tried placing both codes into my functions.php file while using//
< ?php time(); ?>
on the template I’m using but when I refresh the page nothing is displayed…
Can anyone help me get this working Please?
I found another post [//www.jasonbobich.com/wordpress/a-better-way-to-add-time-ago-to-your-wordpress-theme/](//www.jasonbobich.com/wordpress/a-better-way-to-add-time-ago-to-your-wordpress-theme/ “//www.jasonbobich.com/wordpress/a-better-way-to-add-time-ago-to-your-wordpress-theme/”)
At first it didn’t work at all. But I browsed through the comments to an old question I had posted long ago and someone finally replied with a fix to the issue!
This was the fix//
$newer_date = strtotime( $current_time );
$newer_date = time();
Works wonderfully :)
You must be logged in to reply to this topic.