WordPress.org

Ready to get started?Download WordPress

Forums

Latest Tweets Widget
[resolved] Twitter Thumbnails? (9 posts)

  1. s2pidkaspr
    Member
    Posted 11 months ago #

    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/

  2. timwhitlock
    Member
    Plugin Author

    Posted 11 months ago #

    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.

  3. s2pidkaspr
    Member
    Posted 11 months ago #

    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.

  4. timwhitlock
    Member
    Plugin Author

    Posted 11 months ago #

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

  5. timwhitlock
    Member
    Plugin Author

    Posted 10 months ago #

    Latest version 1.0.13 has thumbnail support via the latest_tweets_render_tweet filter.

    See Theming notes for example.

  6. s2pidkaspr
    Member
    Posted 10 months ago #

    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?

  7. timwhitlock
    Member
    Plugin Author

    Posted 10 months ago #

    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 );
  8. s2pidkaspr
    Member
    Posted 10 months ago #

    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?

  9. s2pidkaspr
    Member
    Posted 10 months ago #

    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.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.