On one of my main blogs I maintain several reference posts which are updated regularly in the hopes that they remain a valid resource for my readers. So far these posts have proven to be pretty beneficial to search engine traffic and well received by readers that reference them regularly.
If you run a blog where posts are regularly updated, you may want to consider updating your post meta data to also reflect the last modified date when applicable, rather than showing just the original posting date.
In order to do this, Ardamis has posted a quick code hack to get your single pages to reflect the last modified date. He uses the default Kubrick theme, but it easily apply to just about any theme.
As always, you’ll want to make a backup of your single.php file (or any files you will be changing) before proceeding.
Look for the code that displays the post date. It should look something like the following:
Posted on: <?php the_time('l, F jS, Y') ?>
Now replace it with the following code (slightly modified from Ardamis’ post):
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 ". "; } ?>
Now your posts should show the last modified date immediately after the original posting date, rather than just showing the original post date! I use this on most of my blogs and I am very pleased with it.



Tuesday, August 5th, 2008 at 6:17 am
trying to figure out how to do this in K2 RC6 – thx for the pointers – RH
Tuesday, August 5th, 2008 at 8:30 am
<<< This ended up being pretty easy to do in WP 2.6 after a few trial / errors – just paste the example you want to use from http://codex.wordpress.org/Template_Tags/the_modified_date into theloop.php ~ viola!
… somewhere in the entry-meta div but not in the other php in there. For me line 141 was a good place.
Tuesday, August 5th, 2008 at 10:01 am
@ R. Richard – Thanks for sharing the fix you found. Glad you got it figured out!
The K2 theme works a little different that most WordPress themes because of how they call the WordPress loop. This makes hacks a little more difficult than they are for other themes.
Tuesday, August 5th, 2008 at 10:22 am
My way is the “quick, easy way” – someone with a little more time and patience and at least a measure of knowledge of php could certainly figure out how to to integrate the neccessary code in your hack into the K2 Loop. It seems like it needs to all go in the entry_meta div.
If we could only figure out a way to do all this stuff without messing with the core files… WP upgrades and themes are almost always a traumatic, time consuming experience.
Anyway credit goes to you for pointing the way. Thx
Tuesday, November 18th, 2008 at 9:06 am
Hi, I’ve made a dedicated plugin for this : http://xhark.fr.nf/le-blog/remettez-vos-vieux-billets-au-gout-du-jour-avec-wpx-last-post-mod-1540
Trackbacks/Pingbacks
Leave A Comment
Become one of our
Featured Sites
Recent Trackbacks
Contributing Authors
Archives
Extras
WordPress Hacks Copyright © 2007-2009 | An Apricot Media Website
Template by StudioPress | Custom Design by Kyle Eslick and Blog Design Studio
RSS Feed Email RSS