How to Fix Showing Latest Tweets on Your Website

One very common problem today is getting to show your latest tweets on your website.  Traditionally most people are doing this by using any number of plugins, widgets, add-ons or extensions that link to Twitter.  From there in a lot of cases you are asked to enter your Twitter handle, number of tweets to display and then you are confronted with an error message.  The error message that a lot of people (No you are not alone) are used to seeing this error message when getting their latest tweets to show on their website…

 “The Twitter API returned an error while processing your request. Please try again.

The Problem

The reason why most people who see this error message when trying to add their latest tweets to their website is because they have a shared website hosting account.  What this means and why its important is that shared website hosting accounts are “shared” by multiple people and because they are shared if one of those people misuses Twitter, Twitter blocks the offending IP Address of the server which you share with that user and others.  It sounds pretty nasty right?  And, I am sure you are asking yourself “There must be a solution?” and there is.

The Solution

Because the problem is that the IP Address is blocked we must go a step further to explicitly state to twitter who we are using some widget code to achieve this.  Why does this work?  Well if you remember from before the issue was that we were trying to access Twitter from a shared IP Address and when we put in this piece of Javascript code on our website to show the latest tweets, the code will trigger from the viewers computer and IP address and not the IP Address of your shared web hosting server which makes this a solid workaround.

If you aren’t coders, programmers or a geek, that’s okay, I will show you a way to get this up and running in no time and provide some code to help you do this quickly.

<script src="http://widgets.twimg.com/j/2/widget.js"></script><script> new TWTR.Widget({ version: 2, type: 'profile', rpp: 3, interval: 30000, width: 250, height: 300, theme: { shell: { background: '#a6d5e3', color: '#1a171a' }, tweets: { background: '#c0e1f0', color: '#2b222b', links: '#a1adac' } }, features: { scrollbar: false, loop: false, live: false, behavior: 'all' } }).render().setUser('YourTwitterID').start(); </script>

From here all you should need to do is copy and paste the above mentioned code into your website and change the “YourTwitterID” to your real twitter ID, click save and you are done. You can get fancier with custom coding for those of you who are comfortable and want to customize the look and feel of this information.

Comments

  1. says

    Hey, Luc – tried this script and twitter is still not displaying. I’ve had the API error for months and nothing seems to work.

    Got time to look at it?

  2. says

    Hi Luk
    I’m using the Genesis latest tweets widget on my site and client sites and get the error message a lot.
    I have no problems on a local install so I’m guessing that you are correct and it is a shared hosting problem.

    Presumably you copy and pase the code above into a text widget.

  3. says

    Just tried it on my test site Luk and it works well.

    Even get my twitter image there at the top.

    Need to style things a little then I’ll give it a try on a live site.

    I’ll let the Genesis community know about this workaround.

  4. LeRoy says

    Luc and Keith can you share this work around? Still having issues with it on my site. Thanks much.

  5. says

    Brilliant! I was using the twitter API directly in a widget to control this, but this solution is much more elegant, only displaying my profile pic once at the top rather than tweet by tweet. Thank you!

    @LeRoy: I copied/pasted onto a text widget then replaced ‘YourTwitterID’ with my twitter id between ‘ ‘, like it says on the tin and it worked. What are you having issues with?

  6. says

    I’ve managed to get this to work most of the way. The only issue I have is that my twitter handle appears twice at the top. Any ideas on how to make that not do that?

    P.S. Pardon the mess on my page. I just downloaded a template which has been nothing but an exercise in futility….

  7. says

    Hey Amie,

    Can you send me the link and let me have a look. I went to the main page of your site but couldn’t see the issue. I am sure there is a way around this Amie.

    Luc

  8. says

    Thanks, Luc. This is the link: http://glittermeetsglue.com. It’s on the right side if you scroll down just a little bit. It shows up on nearly every page I have up. It shows a little Twitter profile pic and then next to it, my name shows up twice. I’m starting to think it’s an issue with the template. I’m having loads of issues with it.

  9. says

    Hi Luc, thank you for this. It’s working well on my blog. I have a question though. Is there a way to make the width automatic? My blog looks ok on my laptop but when I checked my iPad, the Twitter widget exceeded the width of other widgets like it’s locked at 300px size. (I use 300px instead of the default 250). Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *

This blog is kept spam free by WP-SpamFree.