Ryan EdmundsGet your latest tweets on your blog – Plugin free

There are a lot of plugins for WordPress that deal with Twitter. It can be hard to find the right one when you have a specific feature in mind. Although there are some really useful ones, sometimes a plugin is not always the answer. If you want to add your latest tweets to your blog but you don’t have the resources for another plugin, or you just like doing things by hand, here is some code you can use to add your latest tweets from Twitter to your blog without a plugin.

Everything we need can actually be accomplished in three lines of code.

The first bit of javascript we need to accomplish this is supplied to us by Twitter.

<script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>
<script type="text/javascript" src="http://twitter.com/statuses/user_timeline/USERNAME.json?callback=twitterCallback2&count=1"></script>

You’ll want to change USERNAME to your Twitter username. You can also change count=1 to whatever number of Tweets you want to show up. You are best to put this script somwhere at the bottom of your template. That way if there is any load issues at Twitter your blog page will still load first.

Now all you need is a line of HTML code to display the Tweets.

<div id="twitter_div"><ul id="twitter_update_list"><li>&nbsp;</li></ul></div>

It is up to you where you want your Tweets to appear. If your blog is widget-ready you can simply paste this HTML code into a text widget and drag it to the desired location. You can also manually edit sidebar.php or even put it in the header or footer of your blog.

From here you are free to add a new selector to your stylesheet to style the updates. Make a CSS selector with the ID ‘twitter_div’ and style it as you see fit.

Follow this blogger on Twitter!

Ryan Edmunds Written by Ryan Edmunds from CrunchPlay.com
Posted on May 22nd, 2009 and filed under WordPress Coding & Design
Do not forget to subscribe to our RSS feed for updates
  • Digg This Post
  • Tweet This Post
  • Stumble This Post
  • Submit This Post To Delicious
  • Submit This Post To Reddit
  • Submit This Post To Mixx

3 Responses to “Get your latest tweets on your blog – Plugin free”

Author comments are in a darker gray color for you to easily identify the posts author in the comments

  1. redwall_hp says:

    That’s kinda neat. I didn’t know you could do that. A couple JS includes and a quick call to the API. Though wouldn’t you need to apply some sort of caching system? The user timeline call is rate limited, and it looks like you’re calling the API on every page load.

    If you want something more advanced, there’s always Tweetable. http://wordpress.org/extend/plugins/tweetable/ ;)

Trackbacks

  1. [...] Get your latest tweets on your blog – Plugin free //tweetmeme_style = ‘compact’; tweetmeme_url = ‘http://www.webmaster-source.com/2009/05/23/blogbuzz-may-23-2009/’; tweetmeme_source = ‘redwall_hp’; [...]

  2. [...] Блоггинг:15 Common WordPress BlundersGet Your Latest Tweets on Your Blog Got Unfollowed on Twitter ? Don’t Take it Personallyна [...]

Comments are closed.

Comments are closed since this post is older than 30 days. However, you can continue this discussion in our popular Blogging Forums

Subscribe To BloggingTips Via RSS Subscribe To Blogging Tips Via Email Follow Us On Twitter Follow us on Facebook Find Out More About Our Newsletter

Sponsors

Blogging Tips Newsletter

Six Figure Blogging

Our WordPress Themes

 

Our Free E-Books