How To Show Last Updated Date In WordPress For Blog Posts?
October 18th, 2016 | by Ravi Chahar || 3 Comments |
When you buy and install a WordPress theme, you will notice that the published date will be showing for the blog posts.
There are many blogs which are showing the last modified date for their blog posts. Do you know how to show last updated date in WordPress?
Many people think that it is better from the SEO point of view. But the reality is that Google algorithm keeps changing and you can’t say that showing the last updated date can improve the SEO of your blog posts.
In this tutorial, you will learn how to show last updated date in WordPress website for all the blog posts.
Edit a few Theme files To Accomplish your Task.
If you know about WordPress theme structure then you would be aware of the code to add author name and date under the post title.
There are many files which control the output of different pages of your blog. The homepage is handled by the front-page.php file and the blog page is handled by index.php file.
You have to edit some more files.
1. front-page.php:- If you are having a theme with the custom homepage then you have to find the front-page.php file to edit.
2. index.php:- This file handles the output of your blog page. Most of the blogs have the homepage as their blog page.
3. single.php:- All the output of the single posts is handled by this file. If you want to show the last updated date on the blog posts then edit this file.
4. page.php:- If you have added the date below the title of your pages then you can edit this file.
If you have any custom template then that file should also be edited.
Find the code to display the date as similar to the code shown below.
You have to replace this type of code which is showing the date with a new code. Though there are different date formats in PHP but still, you can find it easily below the title.
Replace it with the code.
Add this code in each of the files mentioned above. Though every developer has a different coding style but still, the above-mentioned files are the common files required for a WordPress theme.
Did You Get An Answer For “how to show last updated date in WordPress”?
This question can come up in your mind when you see the last updated date on many websites. People crave to use the new things and WordPress gives you the freedom.
There are many functions in the WordPress repository which can be used to modify the default theme. Isn’t that easy to display last updated date?
If you still face any problem, feel free to ask.
Love this article and it definite work great with new post, thanks.
Hello Ravi.
I hate dealing with codes and all that. I’m afraid I’ll do something silly and destroy my entire blog *LOL*
I’ll have to get myself together. I actually like posts that show last update date.
Hey Izuzu,
Most of the people try to show the last updated date for the post. You just have to replace the code of your theme. There is nothing to afraid of.
I can understand the fear. I used to get scared of codes like hell.
Thanks for stopping by.
~Ravi