• Skip to main content
  • Skip to primary sidebar
  • Skip to footer

WP Thinker

The WordPress Playground

  • Snippets
  • Best
  • Guides
  • Reviews
Home / Guides

May 30, 2020 Muhammed Swalih

How to Display the Last Updated Date of Posts in WordPress

how-to-display-the-last-updated-date-of-posts-in-wordpress

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.

  1. Go to your Web disk.
  2. Open the WordPress directory of your website.
  3. Find The files named index.php, single.php, page.php.
  4. 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');?>
  5. 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.

Avatar for Muhammed Swalih

Muhammed Swalih

A WordPress expert who has been tweaking WordPress functions, plugins, themes and almost everything related to WordPress for the past 5+ years.

Primary Sidebar

Related Articles

Footer

WP Thinker is a website that publishes everything related to WordPress, Plugins, Themes, SEO, Blogging, etc.

  • Facebook
  • Twitter
  • Pinterest

Copyright © 2023 · WP Thinker

  • About Us
  • Advertise
  • Write for Us
  • Privacy Policy
  • Terms and Conditions
  • Contact Us
This website uses cookies to serve you better. By continuing to use this website, you agree to our cookie and Privacy Policy.