How to Display Relative Dates in WordPress

Adding Relative Dates in WordPress Using a Plugin

First, thing you need to do is install and activate the Meks Time Ago plugin. 

Upon activation, you need to visit Settings » General page and scroll down to ‘Meks Time Ago Options’ section.

You can select where and when you want to use relative time. You can choose to show it for date, time. or both. You can also limit it to posts not older than a specific time.

If you run a multilingual site or want to change the text ‘ago’, then you can do that here as well.

Don’t forget to click on the save changes button to store your settings.

That’s all, you can now visit your website to see it in action on your posts and comments.

Adding Relative Dates in WordPress Manually

This method requires you to install a plugin, but you will also have to add code manually to your WordPress theme.

First thing you need to do is install and activate the WP RelativeDate plugin.

Upon activation, the plugin will try to replace the default WordPress dates in your theme with relative date and time.

However, since there are so many WordPress themes using different methods to display date and time, it may not be able to work with your theme.

Visit your website to see if it was able to successfully change date and time to relative dates.

If it does not work for your theme, then you may need to edit your WordPress theme files where you want to show relative date and time.

For example, if you want to show relative date on a single post page, then you will need to edit single.php or content-single.php files. For comments, you may need to edit comments.php file.

Basically, you will be looking for any of these lines in your theme’s template files:

Tables can't be imported directly. Please insert an image of your table which can be found here.

1 2 3

You will need to replace them with the following line:

Tables can't be imported directly. Please insert an image of your table which can be found here.

1

You may need to edit multiple files in your WordPress theme depending on where you want to display relative dates on your site.