Display the last modified date of your wordpress posts

November 17, 2008 · Print This Article

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 ". ";
} ?>

Your choice for site templates and wordpress themes


Got something to say?

You must be logged in to post a comment.