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>';

Need Your Help

How to secure passwords in Android Application

android security sqlite encryption passwords

Many of my users have requested a password protection for various data elements in my database. Unfortunately, one of my existing features is backing up the database to a public location (SD Card)...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.