Display Twitter-like “time ago” on your WordPress


Sponsored Links




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.

Display Twitter-like “time ago” on your WordPress - Megan Fox Foxy Out

Display Twitter-like “time ago” on your WordPress

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

Subscribe to Full RSS Feed

RSS FeedIf you thing this article useful, please consider subscribing to our RSS Feed or e-mail updates and stay updated with us. You can also follow @WPTricksNet on twitter for latest updates.

About WP Tricks

We are WordPress Family, we collected and writed useful tips and tricks for you WordPress. We share it for you...

Related Tips and Trick from Local Data and on The Net

How to display your latest tweets on your WordPress blog without

How to count retweets in full text on your WordPress posts; How to display Twitter-like “time ago” on your WordPress blog; Display the number of tweets for each page or Read More

Display the number of tweets for each page or post

Automatically add Twitter and Facebook buttons to your posts; How to count retweets in full text on your WordPress posts; How to display Twitter-like “time ago” on your Read More

11 Awesome Wordpress Development Blogs

Latest recipes: Quickly Secure Plugin Files Insert Custom Content After Each Post How to Display Twitter-Like “Time Ago” on Your WordPress Blog Read More

WordPress Tips: Allow Contributors to Upload Files / WordPress

Display Twitter-like “time ago” on your WordPress → Read More

Learn PHP - PHP Tutorials - PHP Interview Questions and Answers

Display Twitter-like “time ago” on your WordPress blog Twitter have a built-in function that Read More


2 Responses to Display Twitter-like “time ago” on your WordPress

  1. Pingback: Tweets that mention Display Twitter-like “time ago” on your WordPress #tricks #code #functions -- Topsy.com

  2. Pingback: Display Clean Pingbacks and Trackbacks | Unlock IMEI Cellphones

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>