Related RSS Plugin
Keyword Winner

Add Last Updated Date To Posts Or Pages

I ran into a situation where a solution was not real apparent but I had faith in the WordPress platform and it’s millions of developers that a solution could be found. How could I display “last updated” on my pages?

I have a huge authority site in the health niche and because disease information concerning diagnosis, treatment, medications, etc. is constantly changing, I needed a way to display the date of the most recent update on the pages of my site. After some searching, I came up with a php script and a WordPress plugin to help execute the script. In fact, the plugin is called PHP Execution and it will allow not only the script I was looking for to be pasted into my pages but any other php scripts I may want to use.

Before I go too much further, I need to give credit to Tech Based Marketing’s site where I found the best solutions to my problem. The actual script is available in the WordPress Codex but without the php plugin, a user would have to do some editing of different WordPress theme files in order to make it work. While I’ve never shied away from “tinkering” with my css and php files, installing the plugin makes individual file editing a non-issue and speeds up the process tremendously.

The script is the template tag the_modified_date and is found in the Codex as a FunctionReference. It looks like this:  <?php the_modified_date( $d, $before, $after, $echo ); ?>  and the codex reference page goes over all the different parameters of the script. It basically displays the last date of modification of a particular page or post and can be configured to show time stamps as well. The tag needs to be pasted in the html editor of the page where you want it displayed.

My code looks like this:   <p><em>Last update: <?php the_modified_date(); ?></em></p>. I call my reference “update” instead of modified and I wanted it in italics so I added the “em” parameter to the line.  It’s working perfectly and it only took a little bit of research and time to find and configure. Even better, I now have a plugin that will allow me to install additional scripts to call different functions should I need them.

WordPress gets another big “thumbs up”  from me on this one!


If you enjoyed this post, make sure you subscribe to my RSS feed!

Leave a Reply

This site uses KeywordLuv and CommentLuv. Enter yourname@yourkeywords in the Name Field to take advantage