Setup Twitter @Anywhere for WordPress in Seconds!

That’s right, seconds! The twitter @Anywhere was introduced at SXSW conference and launched the dev tools a couple of days ago. It’s a simple javascript-driven set of tools that allows you to basically integrate Twitter functionality anywhere on your websites. Usage is as simple as loading a javascript file and launching a couple of js commands, which instantly give you the power of Twitter on your own blog. Personally, I’m amazed, and couldn’t help integrating it here on my blog. Hover your mouse over @kovshenin to see the hovercards in effect ;) Sweet eh?

It took me around 40 seconds to get this thing to work. This includes downloads and uploads file to the server ;) So open up your functions.php file and paste the following code:

$api_key = "Replace with your API key";
add_action("wp_head", "twitter_anywhere");

function twitter_anywhere()
	echo '<script type="text/javascript">';
	echo 'twttr.anywhere(onAnywhereLoad);';
	echo 'function onAnywhereLoad(twitter) { twitter.hovercards(); }';
	echo '</script>';

That’s it. Literally. That’s all you have to do to fire your hovercards throughout your blog! Just make sure you get an API key before right over here. The Anywhere documentation is all javascript and pretty straightforward, I’m sure you’ll figure it out.

I also looked at the WordPress Plugin Directory for ones registered with the “anywhere” names and guess what! I found at least three of them – anywhere, twitter-anywhere and wp-twitter-anywhere ;) Why write a plugin for something that’s so dead simple? Oh well.. It’s funny how people rush to register WordPress plugin names when something new turns out. Same happened with Google Wave, and there’s still no good Wave plugin for WordPress ;)

8 thoughts on “Setup Twitter @Anywhere for WordPress in Seconds!

  1. Oh and by the way, you can now specify your Twitter account when commenting here ;) Sweet, eh? That took me a little more than a minute and requires WordPress 2.9 or later, cause it uses comments meta. Bug me if you'd like a short tutorial on that.

  2. What also bothered me when dealing a bit with twitter API is that it was slow, extremely slow. What about all these solutions? Are you satisfied with the performances?
    Would there be a way to extract recent tweets from a specified username that would use any of these "new" tools and have good performance?

    • You're right, it is slow. And that is why you should always use async access. And this is not only related to the Twitter API, it's a standard issue of all cross-server access, Flickr, Delicious, Digg, and even Google Analytics! And that's why Google recently launched an async version of their scripts, to speed up the load page.

      I digged through the sources of @Anywhere but I couldn't find out much, cause it's of course all minified and compressed, but it seems that they act only upon the page load, specifically when you call twttr.anywhere. Anyways, all this is done in the browser, so it doesn't depend much on your server speed/bandwidth. Same applies to the official Twitter Widgets, they too seem to load async.

  3. Getting Started With @anywhere « Borasky Research Journal

  4. Plugin-less Integration of Twitter Anywhere with Wordpress | Humbug

Comments are closed.