How To Show Last Updated Date In WordPress Posts

How To Show Last Updated Date In WordPress Posts

Updated On:

How To Show Last Updated Date In WordPress Posts? Bingo! It is one of the most important things about blogging. Because displaying and presenting the most updated information to the readers or visitors of your blog or website should the primary key point of any website or blog. In this way readers or visitors are satisfied that they are reading the most updated information in the article to the date and not any stale stuff, which may not be relevant at the given time.

Last Updated Date on Post

It’s true that not all WordPress theme has the feature by default, like my theme does not have this feature to be honest, but this can be done by modifying the theme code a little bit (Only for advanced users with some knowledge about PHP and not recommended for all). A few days ago I myself, was looking for an appropriate solution for the purpose. But unfortunately I could not find any relevant result. Only some reference of obsolete and buggy codes which I found. So in this article I wish to show the most recent and working solution about “How To Show Last Updated Date In WordPress Posts” while keeping the Published Date untouched.

new_releases

Did you know, Google Set to Name and Shame Sites Lacking HTTPS? Chrome Browser Will Flag Sites Lacking Security Communication Protocol.

Many famous websites and blogs don’t even show any date on their articles. This is a very bad practice and you should never remove dates from your articles or modify to a new recent date to prove updated. The methods I will be showing below will only be applicable for Posts and NOT for Pages. I am mentioning this line because the other codes available automatically adds to the pages too, resulting a broken site. Which is simply not desired.

4 Methods On How To Show Last Updated Date In WordPress Posts

  1. How To Show Last Modified Date And Published Date Together with WP Last Modified Info Plugin
  2. How To Show Last Modified Date And Published Date Together with Code Snippets Plugin
  3. How To Show Last Modified Date, Published Date and Time All With Shortcode
  4. Adding Last Updated Date in Theme Templates
1. How To Show Last Modified Date And Published Date Together with WP Last Modified Info Plugin

WP Last Modified Info Plugin

Until yesterday I was using the second method while a friend of mine, Sayan Datta created this New much waited WP Last Modified Info Plugin through which showing updated date, time, on pages, posts, also adding ‘dateModified’ schema markup data automatically which surely adds value to SEO, customization of text, date format, colors and everything is now possible just setting up with the click of a button. No need to know coding.

Let’s Have A Look About The Plugin Features:-
  • Allows you to display Last modified information in your posts and pages individually.
  • Provides you with options to display the last modified/last updated date above or below your posts and pages.
  • You can also set date/time formats and the position of the timestamp in WordPress Posts and Pages which can be either before content or after the content.
  • Allows you to customize the text which is to be displayed alongside the last modified date (default: Last updated On).
  • Inserts ‘dateModified’ schema markup to your WordPress posts automatically.
  • Allows you to display last modified info on all post types column and publish meta box in the dashboard with the author name.
  • Allows you to sort posts/pages in last updated/modified date time order.
  • Allows you to display last modified info on your post as human readable format, i.e. Days/weeks/months/years ago.
  • Allows you to display last modified info of all posts in the WordPress admin bar.
  • Allows you to display last modified author info in posts, pages.
  • Allows you to add last modified timestamp in post/page’s custom field.
  • Allows you to edit last modified date and time from the post edit screen and quick edit screen also.
  • You can also add template tags to your theme files. Go to the FAQ section for more information.
  • And you can customize all and everything.

First simply install the plugin from WordPress Repository WP Last Modified Info Plugin.

Now in the settings page customize the options as per your need through post options, page options.

WP Last Modified Info Plugin

Only if you want to add custom style to the text you can simply add the following format in the custom css box of the plugin as shown below.

.post-last-modified  {
    color: #5ade06;
    font-weight: bold;
}
.post-last-modified-td  {
    color: #42f1f4;
    font-weight: normal;
}

WP Last Modified Info Custom CSS

So we are done with the most simple option to add updated or modified date and time with any themes or custom WordPress setup!

2. How To Show Last Modified Date And Published Date Together with Code Snippets Plugin

Using this method, you can display the original published date and automatically add a last modified date as well! (It’s not mandatory but I personally prefer to show in my blog.)

This is a very unique approach because it shows the age of your post, while also letting your readers know that you’ve recently updated it or not.

new_releases
The Ultimate WordPress Security Guide to enhance security of your WordPress Site. I bet this is something what you want most. No matter what you blog is about or how big or small, Security always come first and for all. Start digging right now!

Now, for this method, we just need to do is add a Code Snippet to your WordPress site.

You can simply add this code snippet directly to the functions.php file in the child theme, but I suggest using the Free Code Snippets plugin since it makes things easy and prevent you to make less messy things. Also if you change theme at any time, you don’t have to worry about that.

After installing Code Snippet Plugin, navigate to “Add New” section and add the following code. Please feel free to change the style colors as per your theme design.

function print_last_modified_info( $content ) {
if (get_the_modified_time() != get_the_time() && is_single()) {
$updated_time = get_the_modified_time('h:i a');
$updated_day = get_the_modified_time('F jS, Y');
$modified_content .= '<p class="last-modified-info" style="color: #5ade06;"><strong>Updated On:</strong> <span style="color: #00bcd4;">'.$updated_day.'</span></p>';} $modified_content.= $content; return $modified_content; } add_filter( 'the_content', 'print_last_modified_info' );

Then give it a tittle name and select “Only run on site front-end” option on the view-port.

Code Snippet Plugin

Finally, Save Changes and Activate. You are good to go. Check any of your articles!(Please modify the CSS as per your theme.)

new_releases
Take a look on 14 Best WordPress Page Builder That Cut Out Coding. Sounds interesting, huh? No need to learn coding and all technicalities. Just start and put your blog live in minutes!
3. How To Show Last Modified Date, Published Date and Time All With Shortcode

With this method you will be able to display the post published date, updated date and the time all together just using another Free Last Modified Timestamp plugin.

Last Modified Timestamp

You just need to install the plugin and place the [last-modified] in the beginning of any article you wish to show the updated date and time.

Note: Remember that by using Last Modified Timestamp plugin you have add the code snippet manually for every single article or post.

Last Modified Timestamp on Article

Wow! That was fast, but believe me it took hours to find the correct code with result with the help of my friend. Thanks to him as well!

new_releases
The Ultimate Guide on How To Start a Blog (Step-by-Step). All in all, you need to start a blog huh? But how to start a blog in right way! I guarantee it’ll be straightforward, moderately simple, and certainly straightforward (no moronic language). Sounds great?
4. Adding Last Updated Date in Theme Templates

Heads up! For this method you need to edit specific WordPress theme files. There are many WordPress themes available who now use their own template tags which define how these themes show post meta data like date and time. So be very careful about this one. As I have mentioned before that you need to have some PHP knowledge to go for this method. Always remember to take backups whatever you do!

Read More: Function Reference/the modified time from WordPress Codex.

To do this you need to look for the codes and hooks responsible for displaying the date and time. Just replace that code with the following code, or add it right after your theme’s date and time code.

<!--?php  $u_time = get_the_time('U'); $u_modified_time = get_the_modified_time('U'); if ($u_modified_time &amp;gt;= $u_time + 86400) { echo "Last updated on "; the_modified_time('F jS, Y'); echo ", "; } else {echo "Posted on "; the_time('F jS, Y');} ?-->

Conclusion
So by now we have a clear picture about which method one should deploy for their website or blog. On a personal note, I prefer the first method Show Last Modified Date And Published Date Together with WP Last Modified Info Plugin as it provides information both about published date and modified or updated date. In this way the readers or users will have more specific queries for what they are looking for. Like in my case I simply applied the first method by adding the plugin and customized as per my need. If you want use the other options you are free to use. But I always recommend to go for WP Last Modified Info Plugin or if you want to test the other methods then DO take backup every time. Whether you are working live or on a staging environment. Feel free to share with me if you have implemented any of these methods. I will be more than happy to learn from you.

Previous Post
The Ultimate Guide: How To Start a Blog (Step-by-Step)
Next Post
How To Install Let’s Encrypt SSL Certificate Manually In cPanel

Related Posts

15 Comments. Leave new

  • I’m truly enjoying the design and layout of your blog.
    It’s a very easy on the eyes which makes it much more pleasant for me to
    come here and visit more often. Did you hire out a designer to create your theme?
    Great work!

    Reply
    • Rahul Mukherjee
      April 16, 2018 11:19 PM

      Thanks for your compliments! I hope you will enjoy reading and visiting my site in future too. Regarding the design, well I myself is a Visual Communication Designer (You can read in my about section) and all designs and artworks and everything is done by me only. So any other designer was not required. Thanks you.

      Reply
  • Make your own silicone wristbands
    April 15, 2018 11:30 PM

    Very nice post and straight to the point. I don’t know
    if this is truly the best place to ask but do you folks have any idea where to get some professional writers?

    Thank you!

    Reply
    • Rahul Mukherjee
      April 16, 2018 11:37 PM

      Hi, thanks for your kind words. Well I write my articles myself. But you can search for professional article writers anywhere, just Google it with your location. so you get the best prices also! Cheers!

      Reply
  • Thanks for your post, it is very easy to understand..

    I don’t know, I should tell this to you or not…but I can’t stop myself from saying

    ” Why don’t you contribute for some information focused websites like techCrunch, mashable, android authority, etc…there are many more small and big sites…that need writers like you, as your expressing skill is excellent, I am sure you would get a good fame in that world for your articles”

    If you are already doing it, then please share that, I would love to follow you…

    Reply
    • Rahul Mukherjee
      April 26, 2018 8:33 PM

      Hi Gaurav,

      First of all thanks for your nice words of appreciation. Now, as you have mentioned that why not write for those well known information based websites, well as a matter of fact I don’t want to write as of now on any other platform as I don’t want my articles to go through some weird moderation process by some God Knows who! Please do not think I am against these platforms, not at all if you read my “About Me” section you will understand that I clearly differ from many of the ideas of these giants and I need my own platform, so that I have created my website. Rest for the “Fame and Name” part it’s fine with me as that is not my goal anyway, if people like you are reading my articles (and do comment if you think something is not right or I should change my view, I always welcome positive and constructive criticism) and liking it, what’s more one can ask for? I am happy with it. In future if I feel or get an option to write or publish my articles with other platforms, I will surely do that but on my count. Hope you understand that. Thanks again for asking this question!

      Reply
  • Great article, a question like how you insert this kind of text boxes with the “Read more” button in your message, through abbreviated code or some plugins? you would recommend me some.

    Reply
  • Excellent, I’ll try to create something similar with just CSS and HTML. using a TinyMCE button in the WordPress editor. Thanks for the information, I thought you were using some plugins.

    Reply
  • Hello Rahul… thank you for sharing this info. I’ve just installed WP Last Modified Info Plugin and it works great. I am currently working on to update a lot of my old posts and this really helps. Thank you to you and your friend Sayan Datta 🙂 Btw you are doing a great job on this site with the info the the very nice graphic 🙂

    Reply
  • Online Writing Services
    March 15, 2019 12:37 PM

    Great work and useful information!

    Reply

Leave a Reply

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

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed

Menu

Pin It on Pinterest