So many of you using WordPress for different purposes. Some of you use it for blogging, marketing, personal website and many more. Bloggers will publish some serious contents frequently. As the technology being updated time to time, the articles also to be updated frequently to retain the freshness of them. All set and you updated the articles. Now, how to notify the users about the update? Placing an ad on the sidebar or creating a link on it is a difficult task that can’t be done every time we update our content.
If your articles show the Updated dates on them, it will be very useful for the visitors to determine whether the post is updated or it is an old one. In this tutorial, we are sharing the method to display the last updated Date of Posts in WordPress. Follow the simple steps given below.
- Go to your Web disk.
- Open the WordPress directory of your website.
- Find The files named index.php, single.php, page.php.
- Locate the following code in those three files.
Note: There may be some slight difference in the code as all of them using different themes which uses different formats for the Dates. So determine them and find it.
<?php the_modified_time('F jS, Y');?>
- Replace it with the following code
<?php $u_time = get_the_time('U');
$u_modified_time = get_the_modified_time('U');
if ($u_modified_time >= $u_time + 86400) {
echo "and last modified on ";
the_modified_time('F jS, Y');
echo " at ";
the_modified_time();
echo ", "; } ?>
Now you have completed the steps to Display the last updated date of posts in WordPress and your posts might be showing the updated dates.