Support » Plugin: Simple Twitter Tweets » FR: Twitter-style time diff

  • Resolved Andrew Tibbetts

    (@andrewgtibbetts)


    Needed the ‘ago’ readouts to be exactly like Twitter’s—had to modify the plugin a bit. Hoping you will include something like this in next update.

    Function:

    function twitter_time_diff( $from, $to = '' ) {
    
        $diff = human_time_diff($from,$to);
    
        $replace = array(
            ' hour' => 'h',
            ' hours' => 'h',
            ' day' => 'd',
            ' days' => 'd',
            ' minute' => 'm',
            ' minutes' => 'm',
            ' second' => 's',
            ' seconds' => 's',
        );
    
        return strtr($diff,$replace);
    }

    Modified line:

    <a href="http://www.twitter.com/<?php echo $screen_name; ?>" target="_blank" title="Follow <?php echo $name; ?> on Twitter [Opens new window]"><?php echo short_time_diff($t['time'], current_time('timestamp')); ?></a>

    http://wordpress.org/plugins/simple-twitter-tweets/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘FR: Twitter-style time diff’ is closed to new replies.