The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Implementing an SVG Icon System" Nov 30 - 6:00 PM Eastern

WordPress “Time Ago” Function?

  • # June 6, 2013 at 9:40 pm

    I found this snippet []( “”) .
    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?

    # June 6, 2013 at 9:50 pm

    I found another post []( “”)

    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//

    Try replacing:

    $newer_date = strtotime( $current_time );


    $newer_date = time();

    Works wonderfully :)

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed