Support » Plugin: Latest Tweets Widget » Twitter Thumbnails?

  • Resolved s2pidkaspr

    (@s2pidkaspr)


    It would be awesome if our twitter profile pic thumbnail is on the left side of our twitter posts, just like how twitter does it.

    When can we expect to have this plugin update to have this?
    It looks like right now seeing just plain text, please add the twitter thumbnail as well.

    Thanks for the awesome plugin.

    http://wordpress.org/plugins/latest-tweets-widget/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author timwhitlock

    (@timwhitlock)

    There’s already an issue open for this request.
    http://wordpress.org/support/topic/tweet-author-thumbnail-pics

    I’m afraid there’s no timeline for my implementing it.

    But is it possible to do so?
    I really wish this is something we can be done on this good plugin, everything looks great and functional the way us users want it to, it just really needs the twitter thumbnail and it’ll be complete.

    Plugin Author timwhitlock

    (@timwhitlock)

    It is possible, but only through a theme filter, and only when I’ve made the thumbnail data available to the filter hooks.

    Plugin Author timwhitlock

    (@timwhitlock)

    Latest version 1.0.13 has thumbnail support via the latest_tweets_render_tweet filter.

    See Theming notes for example.

    And how to apply this?
    I tried adding this line on my functions.php

    add_filter('latest_tweets_render_tweet', function( $html, $date, $link, array $tweet ){
        return '<p class="my-tweet">'.$html.'</p><p class="my-date"><a href="'.$link.'">'.$date.'</a></p>';
    }, 10, 4 );

    But its giving me
    Parse error: syntax error, unexpected T_FUNCTION

    Do i need to put <?php ?> on it?

    Plugin Author timwhitlock

    (@timwhitlock)

    You’re welcome.

    If your version of PHP is too old to support anonymous functions, try this:

    function my_filter( $html, $date, $link, array $tweet ){
        $pic = $tweet['user']['profile_image_url_https'];
        return '<p class="my-tweet"><img src="'.$pic.'"/>'.$html.'</p><p class="my-date"><a href="'.$link.'">'.$date.'</a></p>';
    }
    add_filter('latest_tweets_render_tweet', 'my_filter', 10, 4 );

    It works without errors. However, instead of returning an image. It’s returning a url instead.

    On my live website, it displays like this.

    <p class="my-tweet"><img src="https://si0.twimg.com/profile_images/378800000352407938/888cf959fa90408c8595cf6eada1f0ce_normal.png"/>Looks like we have our first bandit.</p><p class="my-date">About 3 hours ago</p>

    Instead of really displaying an image. Any ideas?

    Ok, so i removed the code in the functions. O_o and it won’t revert back to original design i have. It stays.

    <p class="my-tweet"><img src="https://si0.twimg.com/profile_images/378800000352407938/888cf959fa90408c8595cf6eada1f0ce_normal.png"/>Looks like we have our first bandit.</p><p class="my-date">About 3 hours ago</p>

    Like that. Even after removing your code on my functions.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Twitter Thumbnails?’ is closed to new replies.