WordPress.org

Ready to get started?Download WordPress

Forums

Simple Twitter Tweets
[resolved] FR: Twitter-style time diff (2 posts)

  1. Andrew Tibbetts
    Member
    Posted 1 year ago #

    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/

  2. Planet Interactive
    Member
    Plugin Author

    Posted 10 months ago #

    Implemented as an option with various other goodies too ;) coming in v2

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.