How To Make A Custom Twitter Feed For Your Website
Today’s blog post was originally published on January 21st, 2010, and is our most popular to date. As a special gift to you, we are presenting the post again with a few extra updates. Enjoy, and don’t forget to leave your feedback in the comment space below. Happy New Year!
Twitter has become very popular and has turned into a tool that a lot of websites have used to connect with their customers and promote themselves. A great, and now popular, way to show those who visit your website that you have an active Twitter account is to add a Twitter feed to it.

In this post I will show you how to add a custom Twitter feed to your website, providing you with code and styling tips (don’t worry… it is actually very easy).
When it comes to ecommerce and social media, it is clear that nowadays, the first needs the second in order to successfully connect and build online relationships with customers. Many ecommerce software companies, including Miva Merchant, have Facebook and Twitter presences for this very reason.
Our Twitter account also provides us with the opportunity to tell people who may not have heard of us about our company in the bio section of our profile, and through the information contained in our Tweets. If followers want to learn more about Miva Merchant’s ecommerce software, design services, hosting plans, or additional products, they can do so by simply clicking on the link underneath our Twitter user name that will take them to our website.
Twitter provides you with various free widgets that are easy to integrate with your website for those who are not capable of easily designing anything custom, but if you can, try to go the custom rout of creating (or having someone create for you) a custom looking feed.

Choosing The Location For Your Custom Twitter Feed
The first thing to do is to figure out where you would like to add your custom Twitter feed. Typical places to add your feed would be to your homepage, your global footer (especially if you have a large one), or a sidebar that might have navigation or promotional things. Once you know where you would like to place your Twitter feed, figure out the exact size that you have to work with.
Remember that you only have 140 characters maximum in each post on Twitter so there will be a maximum amount of space needed, but make sure that the area you have allotted for your custom Twitter feed has some flexibility to become slightly larger or smaller, based off of what is needed when you test it out for the first time.
Designing Your Custom Twitter Feed
There are not a lot of limitations to how fancy you can make your custom Twitter feed, and you can easily match it to the look and feel of your website. You can also define how many of your tweets (posts on Twitter) you would like to show up, but I will be talking about using just your most recent (only one) tweet, which is the most popular thing to do.
First, try creating a new document in Photoshop (or another image editing tool) at the size you have allotted your Twitter feed to rest in. Reference a recent tweet that you made that is close to the maximum 140 characters. Select that text and paste it into your image editor. Then snag some more text that references how long ago that you tweeted that post (such as “about an hour ago”), copy, and then paste it after your post that you originally pasted. This will mimic the amount of text your feed will dynamically place on your website within the area you allotted.

If possible, try to style that text similar to the style you currently use on your website, or how you would like it to appear once live on your website. Pay close attention to the font and size (make sure it is a web-safe font). This will give you a good idea how much space your text will take up. If it takes up too much space, try playing with the font size and/or line height.
Once you have spent time with your text, it is time to style the rest of the custom Twitter feed. This is everything else that you would like to mold to look like the rest of your website, such as the background color, shadow, outline, texture, or anything else that will apply to the appearance behind the text from your Twitter posts. After you have the appearance of your custom Twitter feed designed exactly the way you want it, you will start chopping it apart to integrate it into the code.
The way that I have found that works best is to have a top image, a bottom image, and a one pixel tall middle image that will scale/tile. The middle image will end up going just where your text from your most recent tweet is. The top image will go above your tweet and the bottom will go below that. Taking into account padding/spacing, chop the top part from the top of your image down to right above where your text starts. Your bottom image will be the same but be cut from the bottom of your image up to where your text ends.
This will account for the spacing/padding that will occur above and below your tweet. Then cut, going from left to right, one pixel high, for your middle image. If you have a gradient applied to the background of your custom Twitter feed, make sure that this middle section is set up to be a solid color with the gradient stopping at the end of the image where it had met the text for the top and bottom portions.
If you have certain styles (such as gradients, while using Photoshop or other popular image editing software) applied to your image, make sure you flatten your image, eliminating the layers, in order to preserve the appearance and not have your gradient or styles reshaped to the new size that you just cropped.
Save your three image files (the top, bottom, and middle sections) as something that indicates what it is, such as that it is being used for Twitter as well as what section it is for. An example would be “twitter_t.png,” with “t” indicating that it is for the top section”
Styling The CSS
CSS allows us to do a lot with the appearance of your feed, including stylizing the text. You will mainly be creating an area for the top image, one image for the bottom area, and then (most importantly) the middle section, where all of the magic will happen.
Remember that this is set up to have the middle section tile so keep that image one pixel high, spanning the width you would like to have your background for your Twitter feed. I have my top image set up to be 34 pixels high and my bottom image set to be 29 pixels high. Those all will be thrown into a container for the area you designated for your Twitter feed. To allow people to visit my Twitter account page, I use the bottom image to link to my page (a popular thing to do, with your “follow me” text placed on there) but this is completely optional.
#twitter_t {
width: 445px;
height: 34px;
background-image:url("your top image");
}
#twitter_m {
width: 415px;
padding: 0 15px;
background:url("your middle image") 0 0 repeat-y;
}
#twitter_container {
min-height:45px;
height:auto !important;
height:40px;
padding-bottom:10px;
}
#twitter_update_list {
width: 415px;
padding: 0;
overflow: hidden;
font-family: Georgia;
font-size: 14px;
font-style: italic;
color: #31353d;
line-height: 16px;
font-weight:bold;
}
#twitter_update_list li {
width: 415px;
list-style: none;
}
#twitter_update_list li a {
color: #5f6d76;
border-bottom: dotted 1px;
text-decoration: none;
}
#twitter_update_list li a:hover {
color: #31353d;
background: #d3f1f9;
}
#twitter_b {
width: 445px;
height: 29px;
background-image:url("your bottom image");
}
I have my site structured so that it is 900 pixels wide with two columns split up with a ten pixel margin between the two columns (with no margin on the outer sides). My custom Twitter feed and my list of recent blog posts are standing side by side, taking up a width of 445 pixels each (both added up with the 10 pixel margin totaling 900 pixels wide). You can adjust the above code to work best within the area you have designated for your custom Twitter feed.
To keep things organized, I named everything starting with the word “twitter,” followed by an underscore with what it does after. Like my images, I have “t” indicating it will be the top section, with “b” the bottom. “twitter_m” will be acting as my middle section and this is where I have my middle image tiling from top to bottom of whatever space is taken up by the things inside. I have the width and padding adjusted to make sure that whatever is inside “twitter_m” will be gapped out from the left and right side similarly to the space I have given using the top and bottom images.

To be placed within “twitter_m” is “twitter_container” which will hold the portion that makes up the text of the Twitter feed, called “twitter_update_list.” In the CSS above, you will see mostly things that apply to the appearance of the text that will be populating the custom Twitter feed, coming right from your Twitter account. If you have your main CSS file organized with all the text styles together in one part of it, you could go ahead and take “twitter_update_list” portions and throw them together with your other text styles.
Since I want to keep the general alignment of things on my site perfect, I would like to try to keep my Twitter feed taking up about the same height as what the list of my 4 recent blog posts are (since they are side by side with the feed in the left column and blog posts in the right). I have my custom Twitter feed set up so that “twitter_container” keeps the height at the minimum desired height to make it look good next to my blog posts section and also have the ability to grow downward if for some reason my most recent Twitter post caused a few characters to jump to the next line.
I implemented a hack to get this sort of thing to work cross browser. I have designed it very carefully so almost in all situations, if I max out the 140 characters that Twitter allows, along with the “posted such and such time ago” text, it will stay within the amount of space I have given it and not have to grow downward. It is better to be safe than sorry and I have seen plenty of these custom Twitter feeds that have characters jumping below where it should, in some cases below the box/graphic the text is meant to stay inside.
Inserting JavaScript
To get your Twitter feed to pull from your latest tweet from your Twitter account, you are going to need to insert some JavaScript into the page your feed will rest in. There are several areas where you can place this code but I, and many others, have found that the best place is to place it at the very end of your code, right before the end </body> tag.
<script src="http://twitter.com/javascripts/blogger.js" type="text/javascript"></script>
<script src="http://twitter.com/statuses/user_timeline/REPLACE.json?callback=twitterCallback2&count=1" type="text/javascript"></script>
In the code above, swap the word “REPLACE” with your account name. An example would be if your account name was “twitter.com/ChrisKirkman,” you would just place “ChrisKirkman” in there instead of the word “REPLACE.” If you do decide to display multiple tweets, instead of the one that I suggested, then all you will have to do is change where it says “count=1” to whatever number of tweets you would like to display. Where it links to “blogger.js,” you can have your own file on your server that you link to that has the same information with some minor tweaks, if you like.
Inserting The HTML Into Your Page
<div id="twitter_t"></div>
<div id="twitter_m">
<div id="twitter_container">
<ul id="twitter_update_list"></ul>
</div>
</div>
<div id="twitter_b">
The code above references the CSS that was styled earlier on. Based off of your layout, all of that code could be thrown into another container (or table) to allow it to work best with the rest of your layout design.
Putting It All Together
Once you have everything in place, push it live on a page that you can test it on. It will more than likely take some tweaks and changes to get it perfect but once you have everything adjusted, it will work fantastically and serve its purpose of allowing visitors of your website to see that you have a Twitter account, are active on Twitter, read what your last tweet was, and possibly become one of your Twitter followers.
Something like this has potential to connect you with your website visitors on Twitter a lot more effectively than placing a button or link on your website, usually hidden at the bottom of your page.
Join the Discussion
- December 14, 2010
YES! This is exactly what I was looking for.
- December 15, 2010
doesn’t work, can you post the code unadorned with pictures, etc., so we can just get the feed? I’m trying to replace non-working regular Twitter gadgets, I’m not bothered with the pretty stuff.
- December 22, 2010
Any idea why the official Twitter widget in my blog (http://www.cosmogeek.info/) is displaying in all capital letters?
- December 27, 2010
@Avinash - It looks like you have a text-transform: uppercase style on your .sidebar1. remove that from the css and it should work fine
- December 28, 2010
@Alex - Yeah, one of the my developer friends helped me. This got resolved now.
- January 01, 2011
In my Blog also I have used this, http://venura9.blogspot.com/
but I need to find a way to show the tweets without my @ replies.Any idea on this
- January 04, 2011
Did I miss something about making the bottom image to a link?
Novice here, great tutorial.
- January 06, 2011
Pendle answered my question on non working Twitter gadgets. Well, I will try again tomorrow and hope I succeed this time
- January 10, 2011
since twitter using OAUTH 2.0 and disabeled REST Api this gadget does no longer work
- January 12, 2011
As i have mentioned earlier mine is still working;
if you have any doubt you can check the source at the my blog address mentioned above.<ul id=“twitter_update_list”>
<li>Loading Tweets..</li>
</ul>[removed][removed]
[removed][removed]
- January 20, 2011
So far this has worked out really well for me, thanks for the idea.
Can you tell me how to separate the time of update to appear in a different section?
- January 29, 2011
newbie asking: great code, added styles no prob, but any way to include more than just the latest tweet with this code? Say latest three or five?
- January 29, 2011
...If you do decide to display multiple tweets, instead of the one that I suggested, then all you will have to do is change where it says “count=1” to whatever number of tweets you would like to display.
- January 29, 2011
thank you so much, Terry!
- February 01, 2011
working ! thank you ! simply put the blogger.js into the head tags and the statuses script into twitter_update_list div. thanks for sharing!
- February 10, 2011
Does anyone have any examples of websites streaming twitter right now? I’d love to see how it looks!
- February 18, 2011
Hello,
First of all, thank you for the tutorial. Well done! Do you know if there is a way that I could set it up so feeds from certain hashtags would come in?
Cheers,
SAB
- February 22, 2011
Custom Twitter feed not working for me.
- February 22, 2011
Thanks c975a23. That made it work.
- February 23, 2011
Hi, Cool tutorial, got it working on my website but i was wondering if its possible to display your twitter timeline instead of your tweets?
I have setup a specific twitter account just for this website and am only following specific people that i’d like to have appear on this website. possible?
thanks,
max
- February 28, 2011
How can I make the individual list separate more than the line height? Also, why is there an indent on the left side? Thx
- March 07, 2011
Thank you sir!
- March 08, 2011
Anybody know how to add multiple users tweets. Would be nice to have 2 to 3 accounts’ feeds.
- March 14, 2011
The feed works great until somebody re-tweets, then the feed just disapears, any ideas?
- March 16, 2011
Is there any way to do this for secure (https) sites?
- March 17, 2011
If I set it to display the latest say 3 tweets…will this tutorial above put each one in their own separate box/bubble or will it become a single bubble w/ scrolling twits?
I’d like something where each twit was in it’s own bubble. Here’s an example of what I’d like to do at
www.kevinandamanda.com
On the left sidebar you can see Amanda’s tweets. I dig that!
Thanks for the help
PS - some screenshots would make this really helpful for visual learners like me.
Cheers!
Tara
- March 23, 2011
Is there a way to put the date/time stamp on a separate line?
- March 31, 2011
What’s the HTML for the second image feeder?
- April 02, 2011
Great tutorial, exactly what I was looking for! I’ve been tweaking the blogger.js code to look for #tags too. It hasn’t been showing more than my most recent tweet, though, still looking as to where I’ve gone wrong.
- April 02, 2011
Figured it out! I think it ignores retweets.
- April 07, 2011
Awesome, elegant and precise. Fully working on Sustainablr’s log (bottom of the page). Thank you very much.
- April 14, 2011
Thank you very much for information on how to make custom twitter feed. I will definitely apply this to my blog.
- April 18, 2011
This is not working for me no twitter feeds loading nothing
code is
[removed][removed]
[removed][removed]and
<div id=“twitter_t”></div>
<div id=“twitter_m”>
<div id=“twitter_container”>
<ul id=“twitter_update_list”></ul>
<li>Loading Tweets..</li>
</div>
</div>
<div id=“twitter_b”>
- April 28, 2011
I’m trying to implement your twitter feed and am having a hard time. I made a bare bones page to make sure nothing else was affecting what I was doing. Here is the link: http://174.121.85.94/~mainstre/twitter.html
Any help would be great,
Chris
- May 10, 2011
I’m having a strange issue where the twitter feed will only display a random/certain posts. i.e. when set to show 5 it will only display 2 posts and for a while it would only display one specific tweet. Any idea whats going on there?
- May 10, 2011
I used a different feed code and got it working.
- May 10, 2011
what feed code did you use? and where could I find it?
- May 18, 2011
Thank you! Got this working after some tweaking

- May 21, 2011
Perfect! Just what I’m looking for! Kudos!
- May 22, 2011
Thank you for the tutorial! It took some time and some effort and some hacking and some tweaking, but, finally, I have it up and running! Now, if only there was an easy way to syndicate the RSS feed, so Google could scan the content, too…
- May 24, 2011
can i make it as block in drupal?
- June 10, 2011
Thanks for the share!
Worked with a few tweaks
- June 14, 2011
Someone any idea why mine is not working? I just copy’d everything what’s above…
- June 23, 2011
Thank you. If awesome was a planet, you’d be bigger than it.
- June 23, 2011
@Koen: Do you have a link, so I could take a look?
- June 27, 2011
This is working well for me; however, as GL Wheeler mentioned, Also, why is there an indent on the left side? It won’t line up with my column!
And GL, as far as your other question about line height, padding-bottom in the container section adds more space at the bottom, but if you are talking about making more space between tweets, use padding-bottom in the twitter_update_list li section.
- June 28, 2011
i’m definitely a noob, but i’m not sure i see where the javascript gets called inside the html code? i copied and pasted the javascript just before the </body> and nothing relevant shows up anywhere, even before i organize any of the <div>‘s….
thanks for the help!
- July 08, 2011
Awesome stuff. This is exactly what i will be adding to my store. Thanks for putting this together.
- July 08, 2011
awesome work. Worked perfectly. Thank you very much.
- July 10, 2011
Great tutorial! Mine was working but while testing, it stopped working. I looked at the file
.json callback file and got the following error:
twitterCallback2({“error”:“Rate limit exceeded. Clients may not make more than 150 requests per hour.”,“request”:”\/statuses\/user_timeline\/KonsultInternet.json?callback=twitterCallback2&count=2”})
However, I only refreshed about 10 times so I’m unsure about what’s going wrong.
- July 13, 2011
Orpion,
What are all your CUFON scripts for? Do they just style all of your tweet text?
- July 13, 2011
Also Orpion,
Did you need this jQuery script to make your twitter feed work?[removed][removed]
Thanks.
- July 19, 2011
Thanks! This is what i was looking for.
- July 22, 2011
@Terri: I indeed used Cufón to style all the tweet and normal text. That’s what Cufón for, after all ^_^, to style text with the font of one’s liking…
The jQuery script is NOT used to make the Twitter feed work. It is only used to make Cufón work!
Did these answers clear enough up for you?
- July 23, 2011
Orpion,
Yes, it did. I am very new to JQuery code this was probably the 2nd time I’ve used it. I was just curious as to what everything did and was successful at getting mine to work with a little help.
Thanks, and cool site use of Twitter!
- July 28, 2011
anyone figure out how to show the rewtweets? thanks
- July 29, 2011
Great tutorial. Got it working fine, but is there any way to have rolling tweets? I only want to show 1 tweet at a time, but for the last 3 or so tweets to go round in circulation.
I have changed count=1 to count=3 but that displays all 3 at the same time, rather than the last few tweets on loop. Any ideas?
- August 03, 2011
Hi there
I am a complete newbie to coding however I think Ive manged to follow your tutorial, brilliant thankyou!
Wondered if you could help me, I would like to add line spaces between my twitter feed, is this possible? If so where does it go in the code?
Thankyou!
Jo
- August 10, 2011
don’t you need a </div> after <div id=“twitter_b”>?
- August 20, 2011
First off, I love this. It’s great. But I am trying to have 4 different feeds of 4 different accounts but this only seems to support one per page. I’ve tried and tried. Anything at all would be awesome. Thanks!
- August 22, 2011
Thanks for this great piece of code !!
My question; in explorer there’s a dent on the left, like a padding, but it’s not in safari and firefox. I stripped the code but it stays with a change in positioning in explorer.
Any suggestions ??
- August 26, 2011
This tutorial worked very well for me and I had it working great with a few changes for appearance. But then yesterday it stopped working. I really don’t know what happened. Could someone help. The site is http://www.woodburysch.com/schools/evergreen
Thanks
Jim
- August 26, 2011
my feed is kind of weird. it works with short tweets, but not with retweets or longer tweets.
I tried adjusting the twitter_container height, but that didn’t work. I think the problem could be the text doesn’t wrap? How do I fix that?
- August 28, 2011
I am also Tweeting on my site and all of a sudden the Tweets stopped appearing. IE9 doesn’t seem to work well with my code and now Firefox. I am stumped. Anyone have any suggestions? Check out the site and scroll to the bottom of the page. Thanks!
- August 28, 2011
After reading SteveR’s comment I checked out site using Opera and the Tweets are working. So as SteveR says there must be something with my code. Can anyone help?
http://www.woodburysch.com/schools/evergreenThanks
Jim
- August 29, 2011
I was just on the web designer’s section of the Twitter web site. It would seem that a lot of people are having a problem with IE9 doing a way with their live feeds. They have posted a fix for PHP but not JavaScript. It is found at https://dev.twitter.com/discussions/1232 . Look for the fix all the way at the bottom of the page.
But I still need the fix for JavaScript. Anyone have one???
Jim
- September 15, 2011
Hello I followed this guide carefully step by step. No matter what I do I don’t seem to be getting any feeds at all. Doesn’t work with safari, firefox, nor google chrome.
Anyone else having this issue?
Mori
- September 20, 2011
how to put the twitter avatar in the widget??
- September 22, 2011
@jonathan
for the date to appear on new line:
#twitter_update_list li a {
display: block;
clear: both;
}
- September 24, 2011
Great tutorial! Thanks…worked for me until I started tweaking it to suit my site and then *poof*...it didn’t return again T.T
Tried shifting the script tags accordingly and also removed all stylings but it didn’t work too. I also went to Orpion’s site and after one refresh…it also *poofed*
Is Twitter stopping developers from using these tweaks and want to force them to use the widget? Just wondering…
- September 27, 2011
I’m finding that if the twitter feed stops working, I just go to Twitter and log in, and then the feed on the website I manage starts working again, even though the feed isn’t for my Twitter account. WUWT? Is that what happens for my readers as well?
- September 28, 2011
I’m in the process of learning HTML and CSS. I followed the instructions step-by-step and it worked YEAH! but I have one question, when you view it on the web you have a DOT before each post, and I can’t delete the dot. Would someone PLEASE share the instructions on how to do so….
- October 07, 2011
When I change the count on the feed from 1 to 3 nothing happens. Why is this ?
- October 08, 2011
This does not work for me…
Here is the site, please let me know what I am missing…
http://officialgoldhands.com/home/twitter-updates/
I’m just looking for it to show and then I can stylize everything afterwards but my Tweets wont even show.
- October 20, 2011
Did anyone figure out how to put a space between tweets? Everything works fine, just all my tweets are crammed together. It would be awesome if I could get this going. Thanks in advance!
- October 26, 2011
I would be very interested in pulling from twitter data that is the result of a search for some keywords. Can you help me with that?
- November 01, 2011
Does anyone know how to make this show retweets? Any help would be much appreciated.
- November 04, 2011
Fantastic & very helpful! I’m wondering is there anyway to get this to work with twitter lists?
- November 05, 2011
Hey I bought a 5$ package on codecanyon, to do this, and it ended up being really confusing to instal. I found this and it was much easier to use. This was even easier to customize from what I saw of the package, thanks a bunch man.
- November 08, 2011
Wow, this is a simpler and better tutorial than what you’ll find on Twitter.com. Thank you very much!
- November 14, 2011
Doesn’t show tweets until number count greater than 1 and also doesn’t show RTs
- November 18, 2011
Anyone know how to just show tweets with a specific hashtag?
- December 05, 2011
I got this error message after trying to save my template: “Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly.
XML error message: The reference to entity “count” must end with the ‘;’ delimiter.”I have tried adding ; after “...count=1;”’ or even “....count=2’;” but it doesnt work.
- December 18, 2011
Great Article. Its so easy to add custom Twitter feeds to your website without using the horrible one that Twitter provides.
- February 28, 2012
Very tutorial post indeed! It is a great information for me.
I didn’t know How To Make A Custom Twitter Feed. A Custom Twitter Feed is very important for my own Website. So it is very helpful composition for me. Thanks!!! 
- March 21, 2012
I think these live twitter feeds are amazing. Look at it here: www.ferreirajohnson.com



