Home » Labs » How to display twitter like time in WordPress site  

How to display twitter like time in WordPress site


Filed under Labs

If you want to show time format in 1 day ago, a month ago etc. then here is the code. For showing the date in twitter like format just copy below code to your functions.php in WordPress theme and call the function where you want to show date.

 
<?php 
function titter-like_time( $type = 'post' ) {
        $d = 'comment' == $type ? 'get_comment_time' : 'get_post_time';
        return human_time_diff($d('U'), current_time('timestamp')) . " " . __('ago');
}?>

Posts you may like: