Skip to content

Instantly share code, notes, and snippets.

@dylan-k
Created August 1, 2013 21:09
Show Gist options
  • Save dylan-k/6135346 to your computer and use it in GitHub Desktop.
Save dylan-k/6135346 to your computer and use it in GitHub Desktop.
Wordpress: Display Modified Time For example, if you posted an article on July 19, 2009, and you found out three days later that there was an update to the story. You can just edit the article, and it will show July 22, 2009 at the timestamp for last update. First you need to open these three files: index.php single.php page.php
<!--Then you will need to locate the following code -->
<?php the_modified_time('F jS, Y');?>
<!--Note: Since there are so many formats of displaying dates, you might not see the exact code, but something along this line.
Replace it with:-->
<?php $u_time = get_the_time('U');
$u_modified_time = get_the_modified_time('U');
if ($u_modified_time >= $u_time + 86400) {
echo "";
the_modified_time('F jS, Y');
the_modified_time();
echo ", "; } ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment