Recently I’ve been having problems finding a solution to getting my Twitter updates displayed in the sidebar of my blog. I was using a plugin that did this for me, but when it stopped working I went looking for a new solution. I thought of the RSS that is built into WordPress, as that is what I am using to feed some of the other content in the sidebar.
When I first set it up everything worked perfectly. It was even better than the plugin I was using. It gave a link to the RSS feed, my twitter profile, and a link to each of the tweets, along with the date that everything was posted on. This was great. I loved seeing links to each tweet, and the date was nice too.
Within the last week this stopped working though. WordPress was still seeing the RSS feed, but wasn’t getting updates, and there was an error message that looked kind of like this:
Warning: Attempt to assign property of non-object in/wp-root/wp-includes/rss.php on line 449
It turns out that somewhere along the line there were too many updates trying to go through. I think it was on Twitter’s end because on some of the other feeds I have more updates in the feed than are actually being displayed. For example, my delicious feed includes 15 items in the actual feed. If you were to click on the feed link you would see all 15 items, but there are only 10 items being shown on the blog. WordPress is setting a limit of 10, which is one of the options when you setup the feed for the RSS widget.
The Fix
Since WordPress wasn’t actually getting the updates, it was displaying there error message shown above. What I decided to to was to check out the api, and sure enough you can set a limit. Since I was only showing 5 updates on the blog, I decided to set a limit to 5 updates with the count parameter. The URL will end up looking something like this:
http://twitter.com/statuses/user_timeline/10673592.rss?count=5
The count parameter sets how many updates are in the feed. You will obviously switch the 10673592 number for your own account id on Twitter. You can get that by clicking the RSS feed link on the bottom of your Twitter home page. You can also use your Twitter username instead of that number.