Title: Implement function time_ago
Last modified: July 9, 2019

---

# Implement function time_ago

 *  [henriksteenoslo](https://wordpress.org/support/users/henriksteenoslo/)
 * (@henriksteenoslo)
 * [6 years, 11 months ago](https://wordpress.org/support/topic/implement-function-time_ago/)
 * 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](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fimplement-function-time_ago%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

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

 * ![](https://i0.wp.com/themes.svn.wordpress.org/minimal-grid/1.3.0/screenshot.
   png)
 * Minimal Grid
 * [Support Threads](https://wordpress.org/support/theme/minimal-grid/)
 * [Active Topics](https://wordpress.org/support/theme/minimal-grid/active/)
 * [Unresolved Topics](https://wordpress.org/support/theme/minimal-grid/unresolved/)
 * [Reviews](https://wordpress.org/support/theme/minimal-grid/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [henriksteenoslo](https://wordpress.org/support/users/henriksteenoslo/)
 * Last activity: [6 years, 11 months ago](https://wordpress.org/support/topic/implement-function-time_ago/)
 * Status: not resolved