Adds the last modified time to the admin interface as well as a [last-modified] shortcode to use on the front-end.
This plugin adds information to the admin interface about when each post/page was last modified (including custom post types!).
Enhanced areas:
Last Modified
column which is also sortable.post.php
) – added Last modified on: *timestamp*
to Publish
meta box.Post updated. *timestamp* View Post
,No options currently available, but the output can be fully customized with filters and the shortcode can be easily customized using attributes!
This plugin does not yet enhance the new editor provided by Gutenberg and introduced as the default editor in WordPress 5.0. No plans exist to add support for this although it may be added in the future.
Other areas of wp-admin enhanced by the plugin still work, as does the classic editor.
last-modified-timestamp
folder to the /wp-content/plugins/
directory.This plugin does not change the public facing appearance of your website, but gives you a few ways to add this if you wish.
[last-modified]
shortcode. See below.The best way to provide the last modified timestamp to search engines is by using a plugin to add an XML sitemap for your website. This is a special kind of document which provides various information to search engines about all the content on your website, including when each was last modified. Many SEO plugins provide include this functionality with them, but there are many standalone plugins for this as well. This allows search engines to reference a single file (which is automatically kept up to date for you by the plugin) to know exactly what content has changed on your whole website since it was last indexed, rather than recrawling every page.
This plugin may be used to display the last modified date and time to a reader on your website, but it is not intended as a tool for SEO.
[last-modified] Returns the last modified timestamp in this format date seperator time
.
Attributes (all optional)
datef – specify a date format using the PHP date format.
timef – specify a time format using the PHP date format.
sep – specify the character/text you want to use to separate the date & time.
format – define the output format using placeholders %date%
, %time%
, and %sep%
. Other text can be used as well.
By default, the plugin mimicks the time & date formats used in the same context (ie: admin tables, publish box) that WordPress uses.
As mentioned above, LMT uses PHP date format strings for the formatting of the outputted date & time.
To customize the output with a shortcode, use the attributes as described above.
To customize the output in an admin context, a filter may be used.
For example, if you wanted to change the time format in the admin messages that appear after a post is modified to a 24hr format with leading zeros, add this to your theme’s functions.php:
function my_lmt_defaults( $d ) { $d['contexts']['messages']['timef'] = 'H:i'; return $d; } add_filter('last_modified_timestamp_defaults','my_lmt_defaults');
Models the function naming convention used by WordPress for get_the_content
/ the_content
and similar functions.
get_the_last_modified_timestamp()
– returns timestamp.the_last_modified_timestamp()
– displays/echos the timestamp.These functions accept 2 arguments, both are optional:
$context
(string) to output formatted according to a defined context (ie: admin messages, posts table, etc.)$override
(array) using this will override any defaults that are specified here, but output can still be overriden at final output.array('datef' => 'M j, Y', 'timef' => 'g:i', 'sep' => '→', 'format' => '%date% %sep% %time%')
Major Update
[last-modified]
shortcode.Last Modified
column in the admin post/page tables is now sortable!Last Modified
column to account for extra width needed for sortable arrow.Last Modified
column in the admin post/page tables.