Web Design Blog

This is where we store some of our Web Development thoughts, tips and tricks, just because we like to share.

How To Display Latest Tweet On Website

Here’s a really quick and simple way to display your latest Tweet on your website like the example below (the graphics obviously won’t appear, just the Tweet):

Latest Tweet

1
2
3
4
5
6
7
8
9
10
11
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function ()
{
 $.getJSON("http://twitter.com/statuses/user_timeline/USERNAME.json?callback=?", function(data) {
  $(".show_tweet").html(data[0].text);
 });
});
</script>
 
<div class="show_tweet"></div>

Simply replace USERNAME with your unique Twitter username. The show_tweet class is where the Tweet will display.

The “follow us” link won’t appear by default, I hard-coded that into the show_tweet div :)

It’s as easy as that.

30 Nov 2011 / 1 Comment / jQuery Scripts & Helpful Snippets / by Maruf

1 Comment

  1. Roberto Torres
    04/12/2011
    1

    Thanks for such an excellent code!!

    I have a question for you, what is needed to put a specific font into the latest tweet? Let’s say Verdana.

Leave a Reply

© 2012 BrightCherry :)