Most of you probably use the_date() or the_time() in WordPress themes and plugins to display when a specific page, post was published. If you post a high volume of articles each day it may be beneficial to follow a design pattern similar to TechCrunch or Mashable to display the time a post was published in “hours ago”, or “minutes ago”. If you’re using WordPress, this is wicked easy to do with the human_time_diff function.

Posted <?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' ago'; ?>

This will give you something like:

Posted 4 hours ago

About the Author

Kevin Leary is a freelance developer in Boston, MA with a strong portfolio of work, and over 13 years of experience as a programming consultant and digital strategy provider. Interested in working together? Hire me for your next project.