There are some ways to display twitter-like “time ago” date format in our WordPress. We can use plugin (we recommended this plugin) or we can create and write little functions to handle this. On this tricks I will show you how to created using functions. Write down this functions on your functions.php in your theme.
function time_ago_comment( $type = 'post' ) {
$d = 'comment' == $type ? 'get_comment_time' : 'get_post_time';
return human_time_diff($d('U'), current_time('timestamp')) . " " . __('ago');
}
To use this functions is simple. Open your single.php, index.php or whatever you want put this code and write down this code
<?php echo time_ago(); ?>
This code using standard WordPress function human_time_diff. If you think our today tricks (Display Twitter-like “time ago” on your WordPress) useful on you. Help me share this post in your favorite social bookmarks or social networks. Thanks for UpThemes for share this great code and WP Recipes.
Photos courtesy of Popoholic




Pingback: Tweets that mention Display Twitter-like “time ago” on your WordPress #tricks #code #functions -- Topsy.com
Pingback: Display Clean Pingbacks and Trackbacks | Unlock IMEI Cellphones