WordPress 2.6 introduced post revisions, a form of version control that allows you to review or revert to previous editions of a post or page on your WordPress blog. The value of this feature has generated some debate, largely because it's "on by default" with no easy toggle to disable it. The thing is notification of post revisions is private, within the admin interface. So how do you make the date of last editing public?
One of my pet hates is undated web content; if there's no date I'll often move on without reading the page content. Sometimes you can glean the date of first publication from a post permalink, as in this example (day and name, in Settings > Permalinks):
http://www.bioneural.net/2008/08/02/first-track-logger-for-iphone-released/
There are two problems with relying on this method alone:
- Did you first publish on August 2 or February 8? There are different ways of interpreting dates;
- It's only the date of first publication, not the date the post was last revised.
Clarifying the date of publication
One option is to time stamp the publication date in your theme (as many WordPress themes do), which introduces a little more flexibility to deal with the first issue by specifying the name of the month to combat ambiguity:

A simple code snippet for this would be:
Published by <?php the_author(); ?> on <?php the_date('F j, Y'); ?>
Consult the Codex for options that allow you to customize the display of date and time formats in your theme.
Showing "last modified" dates
I've searched the Codex and the Forums for a means of getting the date of the last revision to display publicly on the edited page itself, using this new in-built code. There doesn't appear to be a documented method, so I wanted to share the method I've been successfully using for some time now—thanks to an article by Ardamis.
This method uses the the_modified_time() template tag (see here), introduced with WordPress 2.1 and usable in the loop (there is also a the_modified_date() tag; see here).
For a quick and basic implementation you could merely insert the following onto every page, giving every page a "last modified" date regardless of whether it was edited again after publication:
<?php the_modified_date(); ?>
Here is the more advanced code I'm using in the loop, which allows a 24 hour "grace" period for tweaking a post before showing a "last modified" date on subsequent edits:
<p class="lastmod"><?php /* Last modified */ $u_time = get_the_time('U'); $u_modified_time = get_the_modified_time('U'); if ($u_modified_time >= $u_time + 86400) { echo "Last modified "; the_modified_time('F jS, Y'); echo "."; } ?></p>
Thus if I publish, then notice an embarrassing smelling mistake, I can go back and make an edit without WordPress displaying a "published on" and "last modified" date that are in fact the same. If, however, some days later I discover an error or wish to add new information in the form of an update, the post will have a visible "last modified" time stamp appended:










0 responses to Publicizing WordPress post revisions