If this tutorial is not what you were looking for, you still have any questions, suggestions or concerns - feel free to let us know. Please help us to serve you better!

Your Name

Your Email

Your Message (required)

captcha

Featured templates

How to display the last updated date of your posts in WordPress

Are you running a blog on WordPress? You may have a news agency and publish some news on your website, or publish any other kind of posts – in any case, it’s a high time to make your website a bit more convenient for the visitors. This can be easily done by changing the way of your posts display and we’re glad to share some useful tips for this.

Today, we’re going to show you how to display the last updated date of your post instead of the default (published) date.

  1. In order to add the ‘last modified’ date to the posts, you’ll need to edit theme files. That’s why, on the first step, you should open you FTP or hosting cPanel File Manager tool.

  2. Next, navigate to your theme folder, located in the wp-content/themes directory. In this example, we are using the TinyFit theme, so we will enter the wp-content/themes/tinyfit folder.

  3. Look for the functions.php file inside and open it for editing with any text/code editor. The recommended ones are Notepad++, Sublime.

  4. Then, scroll down to the very bottom of the file and paste the following code to the end:

    function my_last_updated_date( $content ) {
    $u_time = get_the_time('U');
    $u_modified_time = get_the_modified_time('U');
    if ($u_modified_time >= $u_time + 86400) {
    $updated_date = get_the_modified_time('F jS, Y');
    $updated_time = get_the_modified_time('h:i a');
    $custom_content .= '<p class="last-updated entry-meta">Last updated on '. $updated_date . ' at '. $updated_time .'</p>';
    }
    $custom_content .= $content;
    return $custom_content;
    }
    add_filter( 'the_content', 'my_last_updated_date' );

  5. Finally, save your edits in the file and check the website. The last updated date will appear right above the content of the post!

We hope this step-by-step guidance was useful for you. Feel free to check our blog to learn more tweaks on how to manage your WordPress website as a guru of the web design!

We would also recommend you to view different WordPress themes in case you need a wider choice of website building solutions.