Home « SEO « Display Relative Date WordPress Theme
Display Relative Date WordPress Theme

Display Relative Date WordPress Theme

Today I will tell you human readable data. Like how to display relative date WordPress theme? If you want to display relative date like popular social media sites. Then here you will able to do like you want. If you visit Twitter or Facebook. Then you will read that 2 hours ago instead of the post published on December, 25 2016.

So here we also convert the date format to relative date format.

As you may also check that mostly social bookmarking sites use relative format. Which tell to the user that how much time has passed? The example of the relative format is like as under:

2 hours ago, 4 hours ago etc.

Display Relative Date WordPress Theme Manually

Now see here how to display relative date WordPress theme manually without using a plugin. But if you are a beginner then see here the tutorial: (Site’s link of post-modification)

First of all, I will suggest checking your site’s theme options. Because often WordPress themes have the option to display relative date. So first check your WordPress templated if have the option or not. If not then see here how to display relative date WordPress theme.

Like as if you want to show on single post page then you need to edit single.php or content-single.php

If you want to show on comment then you need to edit comment.php

So after finding the above files you need to search out the below lines:

<?php the_date(); ?>
<?php get_the_time(); ?>
<?php get_the_date(); ?>

After finding just replace with the below line:

<?php relative_post_the_date(); ?>

You can access these files from your WP dashboard » Appearance » Editor

Now if you want to access your themes file using CPanel. Then read the tutorial how to access function.php. When you find function.php then here you will also find all files of your themes.

If you are using Sahifa theme. Then you can reach to meta post by reading that article: WordPress Show Post Update Time.

Lastly, just open the meta post file and find out the above lines and replace with the single line. Hence you will see relative format. Furthermore, I will suggest to install Xampp Local Host on your Windows PC and try on it first. After it paste in your online site’s file.

AUTHORED BY Muhammad Awais Azeem

"Global Blurb since 2015" M. Awais Azeem is the CEO and founder of Global Blurb. The blog designed to share ideas about different topics. My profession is Accountant and I have completed CA Inter from Institute of Chartered Accountants of Pakistan. Me and my time present to sort out any issue regarding SEO, Blogging, Content Marketing and WordPress. Hire Us and Goodbye difficulty.

Want to contribute