Create a shortcode to show when a post was last updated

I like to use shortcodes to generate my bylines in themes. It makes for more rapid development. I use Hybrid Core for my development, and it’s got a handy shortcode called entry-published that shows the post’s publish date utilizing the site’s designated date and time format.

I wanted to do the same thing for a post’s modified date for a project, so I copied (so credit to Justin Tadlock) the shortcode from Hybrid Core and changed get_the_time() with get_the_modified_time().

It’s that easy. You can use this in your templates with the do_shortcode() function, or however you want to display them.

Here’s the gist.

The part that says $domain = hybrid_get_textdomain() can be replaced by whatever your theme’s textdomain is if you don’t use a Hybrid Core theme. Now you can simply use the entry-modified shortcode to show when a post was updated.

It can be quite useful if you have a lot of consistently updated content in your blog and want to show that a post is still up to date. I find it highly preferable to removing the post date entirely.