Reliable Twitter

Problem: On many blogs, I need to add a little twitter badge to a front-page or sidebar. There are many, many great apps out there to do this including Twitter’s own JavaScript badge. The problem is that Twitter’s feed is very unreliable and only works about 50% of the time. That’s completely unacceptable.

Solution: After much looking around, I’ve hit upon a simple method for displaying tweets using Google’s Ajax API. Google’s reliable servers do all the caching for us and life is good again.

Screenshot:

Tips: You can’t use your twitter username. You must use your numeric user ID. Get your User ID Here: http://www.idfromuser.com

Template Tag: If you don’t want to use the Sidebar Widget (and I can’t blame you there), I wrapped this in a function. Here’s what you put in your template tag:

<?php
if (function_exists(reliabletwitter)) reliabletwitter($accountid, $show, $title, $target, $googleapikey, $hidereplies, $targetid, $loadingurl);
?>

The only required field is $accountid. This is what it looks like when you are done:

<?php
if (function_exists(reliabletwitter)) reliabletwitter(11469962, 5, ‘Twitter Updates’);
?>

Credits: I used the excellent Twitter Widget app by Sean Spalding as a base and the Google Ajax concept by Emmett Connolly.

WordPress Plugin Page: http://wordpress.org/extend/plugins/reliable-twitter/

Current Version: 2.2

TROUBLESHOOTING

Google’s Feed Reader can actually be pretty finicky about Twitter’s feeds. I’ve run into multiple situations where some usernames are simply not viewable by Google. There doesn’t seem to be any rhyme or reason to this, but it seems to have to do with secured posts of some sort. If you enter your user id and get a Feed Error, there’s a couple steps you can take. In version 2.2, a custom RSS feature was added. This allows you to tell Google exactly what RSS feed you want it to parse. Some usernames seem to work better if the feed is secure (https). Here are some recommended url’s to try:

  • https://twitter.com/statuses/user_timeline/YOURIDNUMBER.rss (default)
  • http://twitter.com/statuses/user_timeline/YOURIDNUMBER.rss (no ssl)
  • https://api.twitter.com/1/statuses/user_timeline.rss?count=20&screen_name=YOURUSERNAME
  • https://api.twitter.com/1/statuses/user_timeline.atom?count=20&screen_name=YOURUSERNAME
  • You can also parse with an aggregator like Yahoo Pipes. Another one to try is FreeMyFeed.com.

If you are using the template tag version, you can simply pass the url in as your accountid. You can get more information about url’s 3 and 4 on Twitter’s API page.

85 Responses to “Reliable Twitter”

  1. You definitely rock, man!

  2. I installed the plugin and had at that moment exact 4 tweets on twitter. After twittering my 5th tweet, only the 4 oldest tweets were still visible.

    Why is the plugin only showing the 4 oldest tweets? is it a caching issue?

  3. Check the “Bugs” Section above. It has something to do with the Google caching–I haven’t been able to get it to return more than 4 tweets. I’ll take another look at it today and see if I can crack this one.

  4. thanks for the answer!

    My problem is, that the 4 oldest tweets are shown (no matter how many tweets I have). But I expected the newest 4 tweets to be displayed.

    p.s.
    I checked it again. now it works! I think google just didn’t respond somehow.

  5. [...] Eklenti Ana Sayfası [...]

  6. Hi Dave,

    Thanks for the great plugin. It really seems to be more reliable than most of the other “simple” ones.

    I do have a feature request, though.

    Since I use it as a widget (messing with my theme code is too advanced for me at this time) I’d like to see a simple addition of a blurb like “Follow me on Twitter” that’s a link to my Twitter profile.

    So 2 extra input fields in the widget settings – 1 for the actual text blurb and 1 for the twitter user name to be inserted – would do the trick. :-)

    Thanks in advance,

    Marko

  7. Great idea Marko, This has been implemented in version 1.2, now released.

  8. Hi David!

    Very clean and nice one, I like it!

    Is there a simple way, however, to change the font size? Thanks a lot!

    Aka

  9. Yup, you just change the font size in your style sheet.

    ul#twitter_update_list li { font-size: 13px; }

  10. Hey David,
    I got the same error as I posted above: When I write a new tweet on twitter, the new tweet is not showing up “immediately” (not until 1day..).

    Am I alone with this issue?

  11. Hi John, It sounds like an issue with Google’s caching server (feedfetcher). You might try setting your Show # high (like 10 or 20) and refresh, then move it lower again to see if that helps reset the cache. That has worked in the past.

  12. I twittered again, set it to 10 (all my tweets where shown except the newest!), then to 20 (same as 10) and then again to 4. Still the same issue :>

  13. Great widget…thanks!

    IN ACTION: http://blog.builduppeople.com

    QUESTION: How would I replace the “follow me text” with a badge? NEWBIE

  14. You’d edit your CSS and put in something like this:

    #twitter_followme a {
    display: block;
    width: 150px;
    height: 32px;
    url(images/badge.jpg) no-repeat;
    text-indent: -99999px;
    }

    …assuming that your image is at images/badge.jpg and is 150×32. That should get you pointed in the right direction.

  15. I just installed your widget a few days ago. Tonight I made my first TWEET but it did not show up on my blog. HELP! I thought this would be a no-brainer ;(

  16. Kathleen, looks like it is working. Sometimes it can take just a few minutes the first time since it has to run through Google’s caching servers. If you are still having trouble, please post your url.

  17. You’re right. it was here this AM when I got up ;) Can you tell me if I can customize the look? If nothing else I just want the text to be white like the other widgets……….. can’t seem to figure this out.

  18. Is if fixable? Adjustable?

  19. Soapbox Dave –

    How come you have no answer for me!! A simple ‘can’t help ya’ will do if you can’t, but please don’t leave me hanging!!! Sadly with anything WordPress related I am always having to rely on someone else to help me out so HELP ME OUT!! Thanks

    Kathleen

  20. Kathleen, you need to adjust your stylesheet. Add something like this:

    #twitter_update_list li { fonti-color: #FFFFFF; }

    And that will make your text white. You can do all sorts of fancy stuff with style sheets by adjusting margins, padding and background images.

  21. Oh goodness! I meant this:

    #twitter_update_list li { font-color: #FFFFFF; }

  22. THNKS!

  23. That doesn’t work. If I change to text color on my twitter account it will work but if my text is white then you can’t read it o the twitter page itself. Any other ideas?

  24. Hmm… Kathleen – I changed line 103 of your style.css file to read:

    #twitter_update_list {
    color:#FFFFFF;
    }

    in Firebug and it worked just fine. I really can’t get in to big CSS help here, though. The issue is really a CSS one and not anything related to the app itself. Best of luck.

  25. Ok, thanks

  26. That did work. Thank you very much for helping me out.

  27. [...] Eklenti Ana Sayfası [...]

  28. Do the tweets get refreshed on the page automatically (ajax driven) or the user has to refresh the page to see updated tweets?

  29. It doesn’t refresh automatically, though you could set up a timer I imagine to do that. This wouldn’t make a lot of sense though because it can take a while (I’ve seen it take up to an hour) for the google caching servers to catch up to the latest tweet.

  30. Nice work!

    One question. It seems to take a bit of time for the Google Cache Server to update the latest tweet. Is this strictly something on Google’s end or is there anyway we can force it to update faster, etc.?

    Thanks for the nice work – no longer do I have a widget that cannot display any tweets!

    :)

  31. This is strictly on Google’s end. I don’t know of any way to ping it to get it to update faster.

  32. Soapbox Dave &raquo; Reliable Twitter…

    この記事は以下サイトで紹介されています。 WordPressハッカーズ…

  33. Hi,

    I’m trying out your plugin, and i like it! so Kudos!

    It would be cool if it had the option to include @replies. Is it possible? maybe I can have a go at it then, and give you the code if it works.

    kind regards,

    Jeroen

  34. Actually, it does include @replies by default, but I would like to make an option where that would be turned off. I’ve thought about this… the trick is that you would need to return all the results and sort through them, weeding out anything that starts with @. Definitely do-able, just not very high on my priority list. If you do get it done send me an email. web ~at~ sparkweb net and I’d love to incorporate it into the plugin.

    Another thing I need to do is use the widget platform for this so that I can make multiple instances. I don’t know how to do that yet, though!

    Thanks…

  35. [...] Eklenti Ana Sayfası Geri Dön Yorumlar: 0 Okunma: 1 defa Benzer Yazılar:WordPress için Search Twitter Profiles eklentisiWordPress için WP Tuit eklentisiWordPress için WordPress Totals eklentisiWordPress için Born On This Day eklentileriWordPress için Better RSS Widget eklentisi Yazıyı Paylaş: [...]

  36. Great plugin, thanks. One suggestion. The ‘follow me’ link would be much more effective if places at the top, right under the title line. Where it is now, at the bottom and with same link colour as the last twitter link, it is completely lost in the noise. Even making the position configurable at top or bottom would be better.

  37. Everything was great yesterday but now no tweets displayed at all. The plugin shows that it ie reading twitter but cycles forever. Seems broken…

  38. @Ken, It’s not working on soapboxdave.com right now either so it looks like Google’s API is having trouble at the moment. Not very “reliable”…. let’s see if it recovers soon.

    And I like your idea about the option to put the link on top. I’ll look into that.

  39. Hi Dave,

    I have had this installed for a month or so now and it always seems to update at least a few hours, if not a day later than the tweets that I’ve made.

    From what I’ve read, it’s a problem on the Google end, but I was just wondering if you’ve made any recent discoveries on this?

    I don’t run it with a Google API key at the moment… Would this help at all?

    Thanks!

  40. Hi Jase,

    It really does just depend on whenever Google feels like updating. They have their own internal algorithms to figure it out. This plugin was developed to meet the specific need of Twitter going down all the time, but it’s possible that their infrastructure has improved. On a few sites recently I’ve used their branded app and it works nicely.

  41. Hi Dave,
    I love the plugin, it really is the most reliable twitter plugin I’ve found.

    However, I seem to run into an unresponsive script error on occasion. Usually, it’s only when I have a large number of tweets displaying but today it’s happening when I try to show 2. Any thoughts?

    Here’s a screenshot: http://cl.ly/222R2M0V0n1W1o2M0g03

  42. I also just noticed that it seems to only be doing that when I hide @replies

  43. Hi Jake, thanks for writing. I’m currently out of town for a week so I can’t actually look into this right now, but my first guess is that there were a tremendous number of @replies in the feed and it got to the end of available tweets and keeps looking. I think there should be an easy enough fix for this. I will look into this when I get back end of this week. Sorry for the trouble.

    EDIT: Yup, that was the problem. I’ve pushed a new version out that should correct it.

  44. Hi Dave,

    Any ideas why all of a sudden my feed is displaying all my tweets rather than the three that I have in the code to display?

    All has been fine up until now, is this a Google API issue? I assume not as your feed is correct?

    Any help would be great, thanks.

  45. I have the same problem.

  46. Sorry folks, there was a bug in 2.1 released yesterday causing this. I’m really sorry… I just pushed 2.1.1 which fixes this bug.

  47. Thank you very much. =)

  48. Hi Dave,

    It’s still causing a disconnect on my end. I installed the latest. Did I miss something? Again, any help much appreciated. Thanks.

  49. Looks like it’s working now. Thanks! Great work.

  50. http://www.idfromuser.com isn’t able to pull up my ID, or any other ID for that matter. Is there something wrong with the service?

  51. I think it must be down today. It might be out of API calls or something. I’ll check again in the next few days and if I still can’t get to it, I’ll try to come up with another solution.

  52. http://www.idfromuser.com still doesn’t pull up and IDs. Any ideas for a workaround?

  53. Looks like it is back up now, as of Thursday morning. Good thing too, because I haven’t found any other ways for finding the ID.

  54. For some reason the status updates are not working. Its seems to just keep trying to load them but never does. Any suggestions?

  55. Nice plugin. Any way to display the tweets, hashtags, and @s in one group? They are all split up in the feed. Also a RT appears just as “RT + username.”

  56. Uli, I don’t think there is a way to do this.

  57. I love this plugin – thanks for your hard work!

  58. [...] Eklenti Ana Sayfası [...]

  59. Hi David,

    I’m trying to get your twitter widget to work, but it’s telling me that the Feed cannot be loaded. I’ve tried the other RSS options and they don’t work either. If I paste the link to the RSS feed in the browser it does work, and I’ve also subscribed to it in Google Reader (where it works as well). Any ideas?

    http://streetographer.com/about/

    Thanks

  60. After some tweaking, I noticed that it’s trying to load http://twitter.com/statuses/user_timeline not https:// as it is written in the docs. I’ve changed that and it (sometimes) works.

    I’ve also “improved” the follow link to use the Twitter API. If you want the code, please let me know.

  61. Well it was always using http:// and I just discovered that using that won’t work for some people. But crazily enough, doing https:// won’t work for others so I opted, rather than changing it, to let you put the full url in as a custom RSS feed so if the http wasn’t working for you, you could try https. It’s really bizarre how picky the Google Feed reader is.

  62. Thanks David. Happy New Year to you. :)

  63. The solution to ie cycle:

    Add to the trusted sites google.com in your options

  64. Thanks man,
    Finally a twitter widget which works for me!
    great job

  65. Hi David,

    I am trying to implement this into the home template on my test site but when I do and reload the page it gives me a Server Error 500. Any idea why that is? The error goes away as soon as I take out the php function that have written up top.

  66. Try this http://stackoverflow.com/questions/2687730/how-can-i-make-php-display-the-error-instead-of-giving-me-500-internal-server-er to see what the actual error is, and that will give you a better idea of what the problem is.

  67. hello , i use reliabletwitter but no update tweets, please help me.

  68. @Ocean: sometimes it takes a little while for Google to update the feed. It’s not instantaneous. Sometimes it can be a few hours.

  69. Hi, is it possible to include retweets as well?

  70. I believe that RT’s are included. It’s just pulling the RSS feed, so it’s just displaying whatever Twitter is sending.

  71. Great plugin!

    Couple of quick questions —

    1. I am putting two widgets in the footer of our page. I’ve put the ID for both usernames in, and they are both populating items updates from the correct Twitter accounts. However, one of them is populating the most recent comment… and the other one is populating a comment from 663 days ago, in spite of hundreds of updates since then. Any ideas? I have them both set to only display one update.

    2. Can you tell me what CSS element I can change to make get rid of the bullet before the unordered list? I’m fairly certain that I just set “list-style-type” to “none” however, I only want to do it for the twitter update, and I don’t want to get rid of all unordered list bullet points because that would mess up the way wordpress displays lists inside the regular text!

    Thank you so much, really appreciate it :)

  72. Sean, I’d do .twitter_update_list li { list-style: none; } and that should take care of your list style issue. As far as the caching, I’m just not sure. Sometimes it takes Google caching a little while to get itself sorted out. I’d give it 12 hours and see if it clears up.

  73. [...] the Troubleshooting FAQ for some tips on fixing this [...]

  74. Hello, I am problems with this plugin. It simply post the name of the post to twitter, but absolutely no link to the blog. Any suggestions?

    Thanks!

  75. If you can post a URL, I’d be happy to take a look. I’m not sure what’s going on from your description.

  76. URL is http://www.cooklearngrow.com. Sorry for the poor description…too much of a hurry this evening!

  77. I think you might be confused: this plugin doesn’t post anything to Twitter. It simply pulls content from Twitter to display on your website. Looks like it is working properly. The posts match the ones on Twitter.

  78. Tengo el siguiente mensaje de error / Shoe me the next error message:

    “Feed could not be loaded.”

    Alguna idea / any idea?

  79. I do not recommend using this plugin any longer as Twitter is removing support for RSS feeds in the coming weeks.

  80. My tweets won’t load

  81. Hi, 50 days ago was working fine, but now I can not load any tweet… any problem?

    regards
    Amin

  82. I do not recommend using this plugin any longer as Twitter has removed support for RSS feeds.

  83. @Dave: Have been using this plugin and love it; will be sad to see it go due to changes to Twitter’s setup so thanks for letting us know in advance. Is there any other plugin you’d recommend instead?

  84. I haven’t seen one recently, but I have to be honest: haven’t really been looking either. Twitter Widget Pro or Twitter Tools would probably do the trick for you.

  85. @Dave: Thank you for your reply and apologies for the lateness in responding to it. :)

Leave a Reply