Call Us Toll Free - US & Canada : 888-818-9916 UK : 800-069-8778 AU : 1800-990-217
Last Update Post In WordPress

How to Display the Last Update Post In WordPress?

Spread the love

Last updated on June 5th, 2021 at 07:01 am

If any user wants to improve their blog post so this is the basic step that a user must update it all old content according to time to time. It helps to get a better ranking on Google also. But according to most of the users their query regarding how they can display the last update post on the WordPress website? This is a good thing that the user is updating their blog post according to their requirements. But they are not able to display a last update time summary on any post. The user can read this article carefully, we are going to tell you in brief how to show the last update of your post on any WordPress website? In most cases, WordPress is going to show only the date of published when the post is published, but it is not able to show the last update of any blog post. So let’s fix this issue and resolve all query e that have been asked by our users. There are many different methods in this digital world to show or display the last update of any post, in any WordPress website, but our researcher giving the best methods for all of them.

At what time the user required the last update date and time for any blog post in WordPress?

As you already know that WordPress shows the date and time of published articles. In a few cases or few themes do not support date and time updating of any blacklist. This date and time are required when the user makes some changes or updating in any blog post or pages of the WordPress website. At that time users want to show their all visitors that these posts are updated but did you know any reason user is not able to display an updating date and time of any blog post or page. Let us understand with the help of an example. In this example, let’s take news for or any blogger website. If any news from a blogger, the website wants to update their old post or stories and provide some relevant or updated content so they required to update the date and time of that blog post or page. There are many WordPress websites which are not going to display the date and time of their post, this is a very bad experience as a point from visitors. Let’s have stepped ahead and discuss how to display the last update of any blog post or page on the WordPress website?

Displaying last update date in WordPress

In this article as we discuss that we are going to resolve this query that has been asked by most of our users so read this article carefully.

Method 1 shows last update date before any blog post or page content

The user must be required to add a few lines of code just by copying that code into their theme in function.PHP file.

Code

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 .= ‘<p class=”last-updated”>Last updated on ‘. $updated_date . ‘ at ‘. $updated_time .'</p>’;
}
$custom_content .= $content;
return $custom_content;
}
add_filter( ‘the_content’, ‘wpb_last_updated_date’ );

This code generally resembles and comparing two things that are posted, publish date and another is the last modified dates. If a post published date is different than the last modified date so with the help of this code the last modified date will be displayed on any blog post or page content.

If any user wants to add some style present last update date in some attractive manner, then the user must be required to do with custom CSS. The small court that has been displayed below the user needs to add this custom code in2it custom.css of their theme.

Code

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

Method 2- How to update it or add the last update date in theme template?

As we know that there are lots of theme templates present in WordPress which are going to help us to create a beautiful and attractive website without using a single line of code. So, so these all themes contain their own template tags which are going to define their post meta data like date and time. This post metadata is different in all WordPress theme files.

According to our research, most of the theme templates use content templates for the template part to display any type of blog post or page on the WordPress website. Some basic design or created theme templates use single.PHP, archive.php, and many more other template files to show their metadata information.

All users wait for a long time for the code which is totally responsible for displaying the date and time after updating any blog post or page. So user can write this code which is given below into their themes date and time code.

Code

$u_time = get_the_time(‘U’);
$u_modified_time = get_the_modified_time(‘U’);
if ($u_modified_time >= $u_time + 86400) {
echo “<p>Last modified on “;
the_modified_time(‘F jS, Y’);
echo ” at “;
the_modified_time();
echo “</p> “; }

Do we hope that you like this article which is based on How to display the last update of your post in WordPress? At last, we are always curious to know your feedback, so please send your valuable feedback into the comment box, and we always welcome your queries and. Our expert resolves your all queries in a very short time period so if you have any query related to this article we are always welcome you in the comment box and comment there.

Join the discussionSHARE YOUR THOUGHTS

Top 7 WooCommerce SEO Plugins for 2023 to Boost Your Google Ranking