Home WordPress How to display last update date for your WordPress blog post?

How to display last update date for your WordPress blog post?

by Satish Kumar
GUTANN_How_to_display_last_update_date_for_your_WordPress_blog_post

Nowadays WordPress is being most popular Content Management System (CMS), It is not just for blogging, we are using WordPress for Professional websites as well as News sites also. Sometimes we need to update the information what have shared previously. In the case of Blogging and News sites, we need to update the information always for our article.

For example, if you posted any article on Jan 05, 2016, and you get some update information on Jan 10, 2016. So you need to update the information of article and after updating the information it will show the date Jan 10, 2016, at timestamp as last update time for the article.

To do this setup you need to do little bit code changes at below files:

–index.php
–single.php
–page.php

It’s all about to do the code change in all pages where article timestamp is display.

You need to locate the following code in above mentioned files:

<?PHP the_modified_time(‘F jS, Y’);?>

The code may differ as per the different time format but something similar like above you need to search and replace the code with the following code:

[php]
&lt;?php $u_time = get_the_time(‘U’); $u_modified_time = get_the_modified_time(‘U’); if ($u_modified_time &gt;= $u_time + 86400) {

echo "and last modified on ";

the_modified_time(‘F jS, Y’);

echo " at ";

the_modified_time();

echo ", "; } ?&gt;
[/php]

After modification, the code your blog will show the article’s last update time on the timestamp.

Don’t forget to subscribe to GUTANN email newsletter to keep updating yourself with such posts in future.

Dear learners, if you need any help for your blog you can get the suggestion by commenting below or contact me by using the contact form.

 

You may also like

Leave a Comment

5 × 3 =