The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › Back End › WordPress “Time Ago” Function?
I found this snippet [https://css-tricks.com/snippets/php/time-ago-function/](https://css-tricks.com/snippets/php/time-ago-function/ “https://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//
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 [http://www.jasonbobich.com/wordpress/a-better-way-to-add-time-ago-to-your-wordpress-theme/](http://www.jasonbobich.com/wordpress/a-better-way-to-add-time-ago-to-your-wordpress-theme/ “http://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 :)