August 6, 2009

Show Your Latest Twitter Post on Your Website

Filed under: Online Marketing,Web Development — Tags: — Jack @ 2:32 pm

Would you like to show your latest tweet (or tweets) on your website?  Well, here’s a quick and easy way to Twitter-ize your site.

Twitter provides a couple of scripts that need to be included in your code.  It’s probably best to add them right before the </body> tag so the rest of the page loads first.  Go ahead and add them:

<script src="http://twitter.com/javascripts/blogger.js" type="text/javascript"></script>

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

Edit the src attribute of the second script to replace “your_username” with your Twitter username. If you would like to show more than just the latest post, you can change the number where it says “count=1″ to reflect how many posts you would like to show (eg. count=2, count=3, count=4).

Now you need to place this code in your markup where you want the tweets to show up:

<div id="twitter_div"><ul id="twitter_update_list"><li> </li></ul></div>

Your tweet(s) will be added to this div automatically. Style the Twitter div with some CSS and you’re good to go!

One Response to “Show Your Latest Twitter Post on Your Website”

  1. Web Marketing London
    4:33 pm on January 17th, 2012

    Thanks Jack, worked a charm – nice and easy. now just need to start using Twitter!