Change date format in wordpress to relative date
Need a bit of help here as I am not really familiar with PHP. I have two post type and one is displaying date in "x time ago" format and one is display the traditional wordpress date format.
I found this line in my wordpress theme that display the traditional format on my post.
$postheader .= '<abbr class="published" title="' . get_the_time('c') . '">' . get_the_time( get_option('date_format') ) . '</abbr></span>';
Now this theme already has a pre-written function to display time in x minutes, days, weeks, years ago as defined to be '%s' and it's being used in the code below
<abbr class="published" title="<?php the_time('c') ?>"><?php printf( __('%s', 'arras'), arras_posted_on( false ) ) ?></abbr> | <a href="<?php comments_link() ?>"><?php comments_number() ?></a>
My question is .. how to modify the first code to display the format in "x time ago" like the one being used in the second code? I tried to paste the exact same line and it made my page goes blank when reload.
Try using this code:
$postheader .= '<abbr class="published" title="' . arras_posted_on( false ) . '">' . arras_posted_on( false ) . '</abbr></span>';