The easiest way to add a great looking Twitter feed to your website.
We use the the inbuilt methods to output the Widget and Title containers so that it should fit seamlessly into your website.
If you want to style the inside of the Widget below is the HTML structure:
<ul class="kebo-tweets"> <li class="ktweet"> <div class="kmeta"> <a class="kaccount"></a> <a class="kdate"></a> </div> <p class="ktext"> <a><img class="kavatar" /></a> </p> <div class="kfooter"> <a class="ktogglemedia"></a> <a class="kreply"></a> <a class="kretweet"></a> <a class="kfavourite"></a> </div> <div class="kmedia"> <a><img /></a> </div> </li> </ul>
The slider has one significant change which is that the containing unordered list has an ID of 'kebo-tweet-slider'.
You can directly access the object containing all the Tweets like this:
<?php $tweets = kebo_twitter_get_tweets(); ?>
This function checks the cache and refreshes the data if needed. Then returns the object containing all the Tweets. Below is an example of how you might use the data:
<?php $tweets = kebo_twitter_get_tweets(); ?> <?php $i = 0; ?> <?php if ( isset( $tweets->created_at ) ) : ?> <?php foreach ($tweets as $tweet) : ?> <?php echo $tweet->text; ?> <?php if (++$i == 10) break; ?> <?php endforeach; ?> <?php else : ?> <p>Sorry, the Tweet data is not in the expected format.</p> <?php endif; ?>
The object we store contains everything that the Twitter API returns, leaving what you use in your control. Below are some of the most useful items:
$tweet->id_str // Tweet ID $tweet->created_at // Date/Time created $tweet->text // The content text (URLs already HTML links) $tweet->user->id_str // Author ID $tweet->user->name // Author display name $tweet->user->screen_name // Author screen name $tweet->user->location // Author location $tweet->user->description // Author description $tweet->user->followers_count // Author followers count $tweet->user->friends_count // Author friends count $tweet->user->profile_image_url // Authors profile image URL $tweet->user->profile_image_url_https // As above but with HTTPS
There are many ways you could use this information for more than just a Twitter Feed. For example you could also use this to track the follower count of your Twitter account for display on your website.
Currently there is one Shortcode which can be used to replicate the behavior of the Widget. You can call this shortcode in the content of a post and/or page using:
Or by using PHP directly:
<?php echo do_shortcode('[kebo_tweets]'); ?>
Here is the shortcode with all the available attributes and their default values:
[kebo_tweets title="" count="5" style="list" theme="light" offset="false" avatar="off" conversations="false" media="false"]
The available options are:
Title - Text Count - 1-50 Style - list/slider Theme - light/dark Avatar - on/off Offset - 1-50 Conversations - true/false Media - true/false
WordPress has inbuilt functionality for embedding Tweets directly into posts/pages. You can do this by simply pasting the full URL of the Tweet into the content, the URL will look similar to this:
Requires: 3.2 or higher
Compatible up to: 3.8.1
Last Updated: 2014-3-10
8 of 14 support threads in the last two months have been resolved.
Got something to say? Need help?