Plugin Author
Tim W
(@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
Tim W
(@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
Tim W
(@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
Tim W
(@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.