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"; wp_enqueue_script("twitter-anywhere", "http://platform.twitter.com/anywhere.js?id={$api_key}&v=1"); 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 ;)
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.
I'd like to point out a plugin I created over the weekend to do the same.
@anywhere plugin for WordPress
:)
Awesome, but your plugin takes more time to parse, load, initialize, and operate than my 12 lines of code to do the job ;)
Good post. To get the hovercard by mouseover picture event instead of mouseover text, we can try this.
http://www.askabouthugo.com/general/twitter-anywh…
enjoy!
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.
[…] Here’s another one – also links to some more WordPress @anywhere plugins! https://konstantin.blog/archives/setup-twitter-anywhere-for-wordpress-in-seconds/ […]
[…] anywhere code in my theme – the hovercards, the tweetbox and all that jing-bang. I found it here. I also added the tweetbox in addition to that. Here are the code snippets that you need to include […]