Last Modified Date or Time on Wordpress Template Page

I couldn’t readily find an answer to this question via the google. So here it is: If you want to insert a ‘last updated’ or ‘last modified’ date on your wordpress page, then there is a simple bit of PHP code you can use for this:

<?php the_modified_time('F jS, Y');?>

And via Ardamis’s Blog, there is a great way to only display this information if it has been modified after the original post date. This is a good way to let people know if there have been updates since the original post:

<?php $u_time = get_the_time('U');
$u_modified_time = get_the_modified_time('U');
if ($u_modified_time >= $u_time + 86400) {
echo "and last modified on ";
the_modified_time('F jS, Y');
echo " at ";
the_modified_time();
echo ", "; } ?>

This will display the last modified date and time if it is more than 86400 seconds after the creation date – that is 24 hours.

Share and Enjoy:
  • Twitter
  • del.icio.us
  • Digg
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Print
  • StumbleUpon

3 Trackbacks

You can leave a trackback using this URL: http://systembash.com/content/last-modified-date-time-on-wordpress-template-page/trackback/

  1. By Dave Drager on September 16, 2008 at 2:38 am

    New blog post: Last Modified Date or Time on Wordpress Template Page http://tinyurl.com/6oyahn

  2. By .log : ????, ??????? ???????? on September 16, 2008 at 3:22 am

    [...] ??????? ???? ?? ????????? ???????????, ?? ??? ????????????? ???????????: If you want to insert a ‘last updated’ or [...]

  3. [...] Displaying a Post’s Last Modified Date and Time→ [...]

5 Comments

  1. Haven’t actually needed something like this before, but its nice to see it. I can see where it could be very useful in a templating environment.
    kudos

    Posted September 15, 2008 at 11:34 pm | Permalink
  2. SuigueTuh

    Hey,
    My Name is, Donald
    nice overall content
    this is my page:

    http://AoJDPti.spaces.live.com/

    Posted October 21, 2008 at 12:14 am | Permalink
  3. PiterKokoniz

    Hi !!!! ;)
    I am Piter Kokoniz. Just want to tell, that your blog is really cool
    And want to ask you: will you continue to post in this blog in future?
    Sorry for my bad english:)
    Thank you:)
    Your Piter

    Posted April 8, 2009 at 6:14 am | Permalink
  4. mssmotorrd

    It’s the first time I commented here and I must say you share us genuine, and quality information for bloggers! Good job.
    p.s. You have a very good template for your blog. Where did you find it?

    Posted May 3, 2009 at 8:50 am | Permalink
  5. jan

    ds
    fsdf

    Posted August 19, 2009 at 3:38 am | Permalink

Post a Comment

Your email is never shared. Required fields are marked *

*
*