Most of your website visitors are looking for fresh and mostly up to date articles, and your posts are still displaying their old original publication date instead of the date that content was last updated, then its likely your visitors may not be interested in your content based on the fact they might be outdated.
The need to get your contents updated is very important for your website to keep your visitors interested to stay longer, You must have seen some top rated WordPress site with the “last updated” date in place of the published date on the posts or pages.
This article was composed as a result of my research online to enable my website display the last updated date on my posts that requires updates regularly.
Lets get started,
How To Display The Last Updated Date On Your Posts In WordPress
I recently discovered personally that using too many plugins can reduced the speed and performance of your site, So this post is all about you doing it yourself and manually placing codes in your theme to display the last update date on all your posts automatically without the use of a plugin.
The method used display the date of the last time you hit the Update button on a post. This means your visitors will see a publication date that corresponds with the last time that content was updated, rather than the date it was first published.
We have various themes and each theme differs from each other, but the main factor below:
- Go to the Appearance menu and scroll down to editor
- Check for this file “<?php get_the_modified_date(get_option(‘date_format’)); ?></p>”
- you can see the above file on your single.php, function.php, page.php, and index.php.
- Once you have located the “<?php get_the_modified_date(get_option(‘date_format’)); ?></p>” file, just replace the entire file with this “Last updated on <time datetime=”<?php the_modified_time(‘Y-m-d’); ?>”><?php the_modified_time(‘F jS, Y’); ?></time>”
- After you’ve done that, hit the Update File button at the bottom of the screen. Now try updating a post, and then viewing it from the front end of your website.
See screenshot below:
Now you have successfully enable the display of your last modified timestamp via the last updated date. For any issues kindly drop a comment.