Skip to Main Content

How to display relative dates on WordPress

Divi: the easiest WordPress theme to use

Divi: The best WordPress theme of all time!

With over 901.000 downloads, Divi is the most popular WordPress theme in the world. It is complete, easy to use and comes with more than 62 free templates. [Recommended]

Would you like to display relative dates on your WordPress website?

Relative dates are used on many popular social media websites like Twitter and Facebook. Instead of showing date timestamps, these websites show the length of time between the time an item was posted and the time it was viewed.

In this tutorial, we will show you how to display relative dates on WordPress.

But, if you've never installed WordPress discover How to Install a WordPress Blog in 7 Steps et How to search, install and activate a WordPress theme on your blog 

Then back to why we are here.

view-the-Dates for-sur-wordpress

Why and when to use relative dates on WordPress?

As you may have noticed, many social networks use a relative time to indicate when an item has been published.

For example, two hours ago, yesterday, earlier, etc ...

Also read our guide on How to display the date of an article update

Relative dates give users a more accurate feeling of the length of time from when an item is posted to when they view the item. This is the reason why a large number of WordPress blogs and news websites use this type of relative dates.

With that said, let's take a look at how to add relative dates to your WordPress site.

Add relative dates using a WordPress plugin

First of all, what you need to do is install and activate the plugin " Meks Time Ago ". For more details, see our step by step guide on how to install a WordPress plugin.

After activating the plugin, you must visit the page " Settings> General ", And scroll to the" Meks Time Ago ».

You can select where and when you want to use relative time. You can choose to display the date, time or both. You can also limit to articles that are no more than a specific time.

If you have a multilingual website or if you want to modify the text "there is", then you can do it here also in the field " Rewrite 'ago' word ».

Do not forget to click on the button Save Changes To save your settings.

That's it, you can now visit your site to see it in action on your posts and comments.

How to add manually WordPress dates

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

Easily create your website with Elementor

Elementor allows you to easily create any website design with a professional look. Stop paying expensive for what you can do yourself. [Free]

Also consult the 5 common login errors on WordPress and their solutions

If you are new to WordPress for the first time, then you may need to consider reading our WordPress plugin tutorial.

You may also need to find out how to use an FTP client to edit and upload files to WordPress.

Ready ? Let's start.

The first thing you need to do is install and activate the plugin " WP RelativeDate ».

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

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

Visit your website to see if everything works normally. 

How to use SSL and HTTPS with WordPress? Find out in this article

If this does not work for your theme, you may need to edit your theme files where you want to display a relative date.

For example, if you want to display a relative date on the page of a single article, then you will need to edit the file " single.php " or " content-single.php ". For comments, you may need to edit the file " comments.php ».

Basically, you will be looking for one of these lines in the template files of your theme:



You will need to replace them with the following line:

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

Are you looking for the best WordPress themes and plugins?

Download the best plugins and WordPress themes on Envato and easily create your website. Already more than 49.720.000 downloads. [EXCLUSIVE]

Discover How to optimize a database with one click on WordPress

That's it, you can now visit your website to see the relative dates in action.

Discover also some premium WordPress plugins additional 

You can use other plugins to display countdowns on your WordPress blog. In what follows, I propose some of them.

1. Embed Any Document Plus

Embed Any Document Plus is a very useful premium WordPress plugin that allows you to display any document hosted on DropBox on your website.

Embed any document plus wordpress plugin

It allows you to use files in your website. Google Docs and Box.Com. Like any popular website, this plugin will help you integrate documents without any other external tool.

Download | Demo | Web hosting

2. WooCommerce Sales Countdown

WooCommerce Sales Countdown is a fantastic premium WordPress plugin designed to promote sales campaigns on your e-commerce website. 

Woocommerce sales countdown

It sets up a dedicated countdown area with the product on sale, and tells your customers how much time is left to purchase said product at a low price. This plugin also gives you the option to add a countdown to the upcoming balance period.

Download | Demo | Web hosting

3. Offer CountDown Timer Pro

The WordPress premium Offer Countdown Timer Pro plugin allows you to create countdowns for the offers you offer on your website. Packed with handy features to intelligently adapt to e-commerce websites, this plugin is sure to get the most out of your offerings.

Offer countdown timer pro wordpress plugin for events products offers

The most interesting thing about it is the fact that it is very easy to set up and use. You can easily set the timer for the different offers on each page of your website, create a widget, set different time zones, set the expiration time for the offers, etc.

Here are our 6 WordPress plugins to ensure RGPD compliance of a blog

This premium WordPress plugin also gives you the ability to customize the look of your countdown timer.

Easily create your Online Store

Download free WooCommerce, the best e-commerce plugins to sell your physical and digital products on WordPress. [Recommended]

Download | Demo | Web hosting

Recommended Resources

Find out about other recommended resources to help you build and manage your website.

Conclusion

Here is ! That's it for this tutorial. We hope that it will allow you to display the relative dates on your WordPress blog.

However, you will also be able to consult our resources, if you need more elements to carry out your projects of creation of Internet sites, by consulting our guide on the WordPress blog creation.

Feel free to share this article with your friends on your favorite social networks. But, in the meantime, tell us about your Comments and suggestions in the dedicated section.

...

This article features 0 comments

Leave a comment

Your email address will not be published. Required fields are marked with *

This site uses Akismet to reduce unwanted. Learn more about how your comments data is used.

Back To Top
8 shares
Share2
tweet1
Save5