Quick Way to Display Last Updated Date of WordPress Post

If you are trying to find How to Display Last Updated Date of WordPress Post, then you are landed on the right page, I will be showing you the quick method to do the trick.

`

Often you search for a topic and when you open the result page it showed the Published Date which is outdated, what’s next?

  • You simply just leave the page because it’s not the latest information you are looking for !

Because in some cases the latest information is more important, so you should display the Last Updated Date in the WordPress Post.

      It also impacts on the traffic of your blog if you keep your blog posts updated and relevant it never gets out dated.

This is where you can read more about Why Changing Published date to Last Updated date Important

Follow the below steps to display last updated date of WordPress post.

Display Last Updated Date of WordPress Post

How to Display Last Updated Date of WordPress Post

I will be covering this guide in two parts.

  • Step-1: How to Add Code to your WordPress Files
  • Step-2: How to Add CSS Code to Theme CSS file.

Step 1: How to Add Code to your WordPress Files

To make it simpler I have divided this tutorial in two steps, in step-1 we are going to access cPanel and then by using the File Manager we will be editing adding the below code to the “functions.php” file.

Requirements:

Before you begin you must have access to.

  1. dministrative access to your WordPress blog which you can access from this URL: www.yourdomain.com/wp-admin
  2. Control Panel Username & Password of your website www.yourdomain.com/cPanel

Login to your website’s cPanel

Show-Last-updated-date-on-wordpress-post

You are going to add a piece of code into your WordPress file for that you need to find the “functions.php” file in your themes folder.

Last-updated-date-on-wordpress-post

Go to File Manager> public_html /wp-content/theme/ (Double Click on Currently Active Theme Folder)/functions.php and follow the below screenshot.

Change-Published-date-to-latest-updated-post

I will recommend you to make backup copy of “functions.php” file before you make any changes to the master file.

  • Let’s make a copy of “functions.php” as “functions-old.php”
  • Now Select the “functions.php” file and click “Edit”
  • Now copy and paste below code to “functions.php”
function wpb_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 .= '
Last updated on '. $updated_date . ' at '. $updated_time .'
';
}
     $custom_content .= $content;
    return $custom_content;
}
add_filter( 'the_content', 'wpb_last_updated_date' );

WordPress-Tutorials

That’s it now you can click on “Save Changes”

Step-2: How to Add CSS Code to Theme CSS file.

In the Step-1 we have successfully added the code to display the last updated date on the WordPress post.

Now let’s add little bit of style to the text.

In the same Theme folder, you will find “Style.css” File you need to select the file and Click on “Edit” and then pate the below code in the file.

.last-updated {
    font-size: small;
    text-transform: uppercase;
    background-color: #fff;
}

Display Last Updated Date of WordPress Post

That’s All, I hope this guide helps you to display the last updated date on the WordPress post.

Let me know in the comments why you would like to show the last updated date on your WordPress Blog’s Post.

Feel free to share this guide with your friends to let them know how you did change the last updated date in your WordPress posts, share it on Google+, Twitter and Facebook.

If you like this Post, please give us your valuable feedback by pressing Vote Up / Vote Down Button. Thanks.

[thumbs-rating-buttons]


Similar Posts