What's WP
Find Everything Related to WordPress - Best Tutoriasl on WordPress!
How to Showcase the Relative Dates in WordPress Posts

How to Showcase the Relative Dates in WordPress Posts

If you are the common user of Facebook and Twitter, you must have found that these social media platforms use the relative dates to replace the commonly used date timestamps. With this kind of showcase, users can easily know how long ago a post has been published. This time, we’d like to come out a simple tutorial of how to showcase the relative dates in WordPress posts.

In fact, the relative date is really useful to tell people when your articles are published online in a clear sense of time passing. For instance, a specific post is published just now, published two hours ago or published yesterday. Frankly speaking, this is a good way to modify the date and time of your WordPress site. To achieve the relative dates, we recommend you to use the WordPress plugins as we have introduced in the following.

Option 1 – Make Use of the Meks Time Ago Plugin

Firstly, you can consider the plugin of Meks Time Ago. This plugin will change the date showcase of your website articles to the “time ago” format automatically. In addition, it can override the default WordPress date function with your preferred format.

For this, you should decide some settings after installing this plugin on your WordPress site. Here, you should click the Settings button and move to the General part. From this page, you need to scroll down to the bottom section to find the special part of Meks Time Ago Options.

Now, you can make the decision for the following four settings.

  • You can enable the relative dates function for the time format of Date, Time or both of these two options.
  • You can apply this function to some posts that are published older than a specific time amount. Note that you can choose the time range that is from minutes to months.
  • You can choose to locate the word of “ago” after or before the passing time.
  • It is possible that you do not want to use the “ago” word. If so, you can rewrite this word as you want. This freedom is pretty useful if you are running a multilingual WordPress site or your website is not an English based one.

Meks Time Ago Settings

Option 2 – Make Use of the WP-Relative Date Plugin

The second recommended plugin is the WP-Relative Date. Upon the installation, this plugin can automatically replace the default date format of your WordPress site with the relative time and date.

Here, there is a special highlight that you can display the relative date for some specific blog posts or even the comments. However, this requires you to edit the coding stuff for some of your files.

For instance, if you are looking to apply this function to a single article, you can edit the single.php file. If your target is the post comments, you can modify the comments.php file.

When opening the right file, you need to look for the following lines of coding stuff.

Default WordPress Date Coding

And then, you should replace them with the below listed line.

WordPress Relative Coding


Susan Rose is a freelance writer who has a deep knowledge about WordPress. She loves everything related to website building since the freshman year at Christopher Newport University, and loves to share her experience with people all over all the world. In the daily life, Susan loves detective novels as it can train her logical thinking and creativity.