• Dear supporters,

    I would like to implement the function time_ago in the Minimal Grid-theme on the same line AFTER posted time/date. Ex. Posted March 3, 2019 – 4 months ago.
    I use the built in human_time_diff, and have placed this is functions.php:

    function time_ago( $type = ‘post’ ) {
    $d = ‘comment’ == $type ? ‘get_comment_time’ : ‘get_post_time’;

    return human_time_diff($d(‘U’), current_time(‘timestamp’)) . ” ” . __(‘ago’);

    I know very little PHP, and I’m struggle to place “echo time_ago()” correctly between the date and byline in this line in the Minimal Grid-theme:

    echo ‘<span class=”posted-on”>’ . $posted_on . ‘</span><span class=”byline”> ‘ . $byline . ‘</span>’; // WPCS: XSS OK.

    Can anyone help me with the correct syntaxes?

    Henrik Steen
    Oslo, Norway

    The page I need help with: [log in to see the link]

  • The topic ‘Implement function time_ago’ is closed to new replies.