MOin on Jul 10, 2010 | Tips & Tutorials

How to: Display dates as “time ago” in WordPress

Delicious

If you are looking to show WordPress post dates like ‘Posted 2 hours ago’ then you landed on the right place. Just paste the code in your WordPress theme where you want to show the time and date. This human readable Time/Date showing method also work with comments.

For Posts:

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

For Comments:

1
Posted <?php echo human_time_diff(get_comment_time('U'), current_time('timestamp')) . 'ago'; ?>
Stumble it Digg it Vote on Reddit Add to delicious
Tweet it Share on facebook Add to Technorati Float it

Leave a Reply


You can submit your free wordpress theme in WP skinner user submitted themes gallery to get Downloads and popularity. Its Free! ​ ​ Submit your Theme

View All >>

About | Contact | Submit your Theme
© 2012 WP Skinner | Powered by WordPress Top ^