Display Twitter tweets on your blog without a plugin

by Mayur on May 23, 2009

in Blogging

Follow us on twitter Most of bloggers nowadays use Twitter as their social network. If you’re running a blog, you must share your tweets with your blog readers too.

You can simply show your latest tweets on your blog using some plugins or manually. I suggest you to do it manually as it’s not that difficult as you thought.

You’ll require to add only 3 lines of code to your theme to display the Tweets.

1) There are 2 bits of javascript that you’ll need to place anywhere on the page. I’ll suggest to put the below code at the bottom of page, before </body> tag in footer.php

<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>

Remember to replace the word “Username” with your twitter username. Also change count=1 with the number of tweets you want to display.

2) To display the Tweets, just add the below code in sidebar.php or create a widget for it. Use PHP Code widget plugin to insert the HTML code to your widgets.

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

That’s it. Now your visitors will see your latest tweets. This will help in increasing your twitter followers too. Your tweets will look like as shown in below image:

Display tweets on your blog without plugin

Follow Us on Twitter Now !

Related Posts:

Liked this article? Then SUBSCRIBE to RSS Feed or get Free updates via E-MAIL



{ 4 comments… read them below or add one }

Gagan May 24, 2009 at 2:33 pm

interesting, and we should avoid installing plugins for all these small tasks, rather we should use direct method.

Matt October 4, 2010 at 9:39 pm

I don’t understand the HTML. If I copy that verbatim, I get nothing. Doesn’t there need to be something more between the tags than just &nbsp?

If I call up this in a browser, I get nothing but a bullet point:

 

Matt October 4, 2010 at 9:40 pm

The filter took away my tags that added beneath my comment, but I basically copied and pasted what you said below my comment. Thank you!

Mayur October 4, 2010 at 10:18 pm

Make sure you’ve placed the Javascript first in footer.php or header.php. &nbsp? represents non-breaking space.

I’ve tried it long ago and it worked fine (can be seen in the screenshot above).

Leave a Comment

Previous post:

Next post:



   Copyright © 2008-2012 WebTrickz | Sitemap | Privacy Policy | Advertise | Back To Top