For the past month or so I’ve been using Alex King’s fantasticTwitter Tools WordPress plugin to display on this site the latest tweet from my Twitter stream (see sidebar). However, I have one semi-trivial issue with his very robust plugin, namely that it doesn’t allow you to keep @tweets — tweets directed to a particular user — from being displayed. I changed that.
To ensure that my changes wouldn’t break any of the main features of the plugin, the only function I modified in twitter-tools.php was aktt_latest_tweet() (i.e., the function that displays the latest tweet). If you use any of the other features and want this @tweet-exclusion to be plugin-wide, it shouldn’t be too hard to incorporate my changes into the other functions you’re using.
I increased the query limit from 1 to 5, so that the last five tweets are retrieved instead of just the latest. These five tweets are then cycled through until a non-@tweet is found, at which point the loop breaks and the non-@tweet is output to your site. If your last five tweets are @tweets, then the function will simply output No tweets available at the moment, which is what it would otherwise display if there was some error in initially retrieving the tweets. If you’re constantly @replying to other users, you may want to bump the query limit to some larger number.
I should note that this is a modified version of Twitter Tools v1.1b1 (the latest version of the plugin is v1.2b1). If you’re currently using v1.2b1, but invoking only the aktt_latest_tweet() function, then you can safely overwrite your twitter-tools.php file with this modified version. If you’ve made any modifications to either v1.1b1 or v1.2b1, or if you use any of the other available plugin features, then you’ll want to overwrite only the aktt_latest_tweet() function.
Download the modified twitter-tools.php file (remember to change the extension from .phps to .php after downloading).
I think at some point I may completely gut the Twitter Tools plugin, and release a much simpler version that does nothing more than display the latest tweet, minus @tweets.