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. http://www.idfromuser.com still doesn’t pull up and IDs. Any ideas for a workaround?

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

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

  4. 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.”

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

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

  7. […] Eklenti Ana Sayfası […]

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

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

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

  11. Thanks David. Happy New Year to you. 🙂

  12. The solution to ie cycle:

    Add to the trusted sites google.com in your options

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

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

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

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

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

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

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

  20. 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 🙂

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

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

  23. 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!

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

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

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

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

    “Feed could not be loaded.”

    Alguna idea / any idea?

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

  29. My tweets won’t load

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

    regards
    Amin

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

  32. @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?

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

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

Leave a Reply