Do often edit your published posts to update or complete it? If yes, I guess you’d like to be able to display the last modified date. Good news for you, here’s a complete code to do that.
Do often edit your published posts to update or complete it? If yes, I guess you’d like to be able to display the last modified date. Good news for you, here’s a complete code to do that.
In your single.php and/or inde.php, look for the following line:
Posted on <?php the_time('F jS, Y') ?>
And replace it by:
Posted on <?php the_time('F jS, Y') ?>
<?php $u_time = get_the_time('U');
$u_modified_time = get_the_modified_time('U');
if ($u_modified_time != $u_time) {
echo "and last modified on ";
the_modified_time('F jS, Y');
echo ". ";
} ?>
Credit goes to Kyle Eslick for this awesome recipe!
2 Responses
I think this is needed in earlier versions of WP.. the current release doesn’t change the date to the latest modified draft
and i wanna add a recipe in this code. you can use it with current modified time with date
it will be like this
and last modified on February 23rd, 2008 at 03:16.
Trackbacks: