How To Display The Last Updated Date In WordPress Blog Posts

While blogging, Displaying the date when the article was published is crucial. It provides our readers with complete satisfaction of getting the latest information and news.

However,sometimes we need to update our blog posts for adding updated information, Latest Tools, New versions etc. And we need to ensure our readers notice this update.Some Themes Automatically Show this update while some may don’t. If your theme isn’t one of them, you are at the right place.For Showing the last update Notification on your posts, you will have to add a PhP code in your themes’s Function.php folder.

*To find functions.php folder, Go to

Cpanel > File Manager> WpContent> themes> yourthemename

*For Loging into cpanel go to – “yourdomain.com/cpanel”
Upon Reaching your Functions.php folder, edit the folder and at the end add this PHP Code reader:-
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 .= ‘

<div class="”last-updated”">
Last updated on ‘. $updated_date . ‘ at ‘. $updated_time .'</div>

’;
}
$custom_content .= $content;
return $custom_content;
}
add_filter( ‘the_content’, ‘wpb_last_updated_date’ );

This code should be pasted as it is. I have not added the open and close php tag as beginners may break their site. Don’t add anything in this code.

It May look like this :-

display last updated

My Advice –

Remember, removing date from the posts is like deciving your readers. You should never remove dates from a post.

You may find several plugins to add last updated notifications in posts,however most of them had not been updated since 2 years. You want to take a risk? i don’t think so. Better to go with php method as it’s easy and fast.

Themes recommends  : Genesis, Themefiy & ElegantThemes.

Similar Posts:

Exclusive Discounted Price At Hostgator Hosting



Author: Aayush Bhaskar Verma

My name is Bhaskar and i will walk you through a bunch of over my shoulder guides and content marketing tips that i use for my blog.

Leave a Reply

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