Adding "Last Modified on" time to posts

Posted in: Newspaper
Post count: 35

I would like posts to display the last time they have been revised or modified after being published. I have read through a couple of similar topic posts, but haven’t had any luck using the code provided.

Post count: 6600

Hi,

You can find out how to display the modified time here: http://codex.wordpress.org/Function_Reference/the_modified_time
I have also tested this and work fine.

Thanks

Post count: 35

I’m having trouble understanding where and how the code is placed.

Post count: 6600

Hi,

Add this line: <p>Last modified: <?php the_modified_time(); ?></p> to the loop-single.php file, should look something like this: http://screencast.com/t/S7RuGtHhQ9nb
Result: http://screencast.com/t/QOQ1bESL3tdI

Thanks

  • This reply was modified 11 years by Lucian.
Post count: 35

I have it appearing, but now how do I have it display the month, day, and time?

  • This reply was modified 11 years by rparlier.
Post count: 9544

You need to add the variables for the format you want inside the () like in the example on the codex page:

<?php the_modified_time( $d ); ?>

You can look up the letter abbreviations for server time online.

eg.
Year yy 2 digit year 04
yyyy 4 digit year 2004
Month MMMM Full month name January
MMM Short month name Jan
MM Month number (zero padded) 01
M Month number 1
Weekday wwww Full weekday name Tuesday
www Short weekday name Tue
Day ddd Ornate day of month 2nd
dd Day of month (zero padded) 02
d Day of month 2
24 Hour HH Hour of day (24h, zero padded) 03
H Hour of day (24h) 3
12 Hour hh Hour of day (12h, zero padded) 04
h Hour of day (12h) 4
tt AM or PM AM
t AM or PM (short form) A
Minute mm Minute of hour (zero padded) 05
m Minute of hour 5
Second ss Second of minute (zero padded) 06
s Second of minute 6
Epoch epoch Seconds since epoch (1970) 1062201058

Post count: 9544

(admin – feel free to add all of this to the docs; since folks seem to keep asking about this one!) -cs

Post count: 6600

Thanks Christopher!
I’ve added it on our todo list!

Viewing 8 posts - 1 through 8 (of 8 total)
The forum ‘Newspaper’ is closed to new topics and replies.