Ever thought of displaying recent tweets in your WordPress blog ? here is a simple solution for that. Twitter is the most popular micro-blogging platform with many power users and celebrities. Display recent tweets in your personal blog sidebar or showcase them in any of your WordPress blogs.
Follow us on twitter @WPSquare
Recent tweets can be displayed in blog sidebar by using any of these three methods.
- Using RSS Fetching Snippet
- Using Official Twitter Widget
- Using WordPress Plugins
Display Recent Tweets in WordPress without a Plugin
If you don’t want to use plugin or if you feel plugins will slow down your blog, then here is a simple code that helps to display recent tweets in a fly. Learn How to Execute php in WordPress Text Widget and add the below code to text widget in sidebar.
<?php include_once(ABSPATH . WPINC . '/feed.php'); $rss = fetch_feed('https://api.twitter.com/1/statuses/user_timeline.rss?screen_name=
wpsquare'); $maxitems = $rss->get_item_quantity(
3); $rss_items = $rss->get_items(0, $maxitems); ?> <ul> <?php if ($maxitems == 0) echo '<li>No items.</li>'; else foreach ( $rss_items as $item ) : ?> <li><a href='<?php echo $item->get_permalink(); ?>'><?php echo $item->get_title(); ?></a></li> <?php endforeach; ?> </ul>
Replace the highlighted name in the code with your twitter username and save it. You can also use this code anywhere in your theme files. If you are using Thesis or Genesis you need to wrap this code in desired hook.
Display Recent Tweets Using Official Twitter Widget
Here come the official twitter widget with lots of options and preferences. Just navigate to the official twitter profile widget page using the link below and configure the widget.
Just enter your twitter username and your recent tweets will be displayed in the widget. using preferences select number of tweets to display and change colors by using appearance tab. Finally get the code by setting up proper widget dimensions.
Copy and paste the code to text widget in sidebar section. All your recent tweets will be displayed and to change the number of tweets to be displayed, you can directly edit in the code or can configure the widget from scratch.
Display Recent Tweets in WordPress Using Plugins
If you don’t want to mess up with code part, then here are some beautiful plugins to display recent tweets in sidebar. All the plugins are free to use and are available at official WordPress plugin repository. Checkout the info and install your favorite plugin.
1. Twitter for WordPress
Free plugin to display recent tweets in sidebar of your WordPress blog. Simple drag twitter widget to sidebar and configure it (no options panel).
2. Latest twitter sidebar widget
This plugin got many features and can handle twitter feed, links, hash tags etc. Profile picture can be displayed and replies to your tweets can also be included.
3. WP Tweets
Widget ready Light weight plugin with free online support. Options are available to configure twitter username and number of tweets to display.
4. Twitter Widget Pro
This is another great plugin to display recent tweets in WordPress sidebar. Configure the widget by giving a feed title, entering a twitter username and date format etc.
5. Tweet Blender
Finally, tweet blender is just an awesome twitter widget to display tweets based on lists, hash tags etc even incase of multiple users and multiple lists.
Hope you like this ultimate article on how to display recent tweets in WordPress, to receive more articles like this just subscribe to our feeds by using the form below.