Wordpress Tip: Add modified dates to posts
Published May 27th, 2009 in Scripts, Tips and Tricks, Wordpress
On more than one occassion, I have read through an article that seamed relevant until I realized that the date of the article maybe years old. In many cases, the authors have made changes to the article, but the reader really isn't sure about the content of the article because of the age, so they simply pass over the article, regardless of the likelyhood that the content is up-to-date and relevant.
I have modified a piece of code that I use, currently on my megocollector site, to alert the reader of the last time the article has been modified.The code will do two things. It firsts determines the article (or post) time of creation and then compares it to the last modification time. If the creation and modification times are identical, then the code will not display a modified date. However, if the times are not identical, then the modified date will display.
<?php $origdate = get_the_time(); $moddate = get_the_modified_time(); if ($origdate != $moddate): echo '<strong>Modified: </strong>'; {the_modified_date();}; endif; ?>
To use this code, I placed this code in the single.php file where I wanted to display.
Print This Post
Email This Post
Related Articles
- Wordpress: Display Recently Updated Posts with Shortcode
- IIS Logs - A script to decompress 1000's easily.
- Wordpress condition if ... else statement for wp_pagenavi plugin
- Wordpress WP-PostViews plugin to display special characters properly
- Wordpress Site Update Widget


No Responses to “Wordpress Tip: Add modified dates to posts”
Please Wait
Leave a Reply
You must log in to post a comment.