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!
Leave a Comment