An Actual Retweet Button for Jetpack & Sharedaddy

I was thinking about this for quite some time now — an actual retweet button for WordPress, and I wonder why Twitter hasn’t provided one yet, it’s so obvious!

Sharedaddy Retweet Button

Yes, the tweet button is doing a great job these days, but let’s admit, that we content publishers enjoy retweets more than regular tweets to our articles, because:

  • They show your name and your Twitter avatar along with the original message, so when others see your tweet retweeted, there’s a better chance they’ll follow you.
  • They instantly show up in your Interactions and increase the retweet count, so you can always see who’s tweeting your posts, without having to use Twitter’s search.
  • They give you a better chance to get a Top Tweet, thus providing even more exposure.

Continue reading

GPL Freebies: Simple & Social Icon Set (Part 2)

I hope you all got the first part of this icon set, but even if you didn’t don’t worry, this is just an extension to that set that includes Technorati, Yahoo, Github, MySpace, Vimeo and others.

Simple & Social GPL Icons

And just like the first set, released under the GNU General Public License v2 — use this for any personal and commercial projects. No attribution required (although appreciated), feel free to share, modify and build upon.

Download the PSD file and of course retweet this post!

Freebies: A Simple & Social Icon Set (GPL)

Here’s a freebie for you social media lovers — a brand new social media icon set, designed for dark and colorful backgrounds. Feel free to use this on your website or blog. This is one of my first icon sets, so I’d appreciate some comments and feedback.

Simple & Social Icon Set (GPL)

I decided to release this under the GNU General Public License v2 so feel free to use this for any personal and commercial projects. No attribution required (although appreciated), feel free to share, modify and build upon.

Download the PSD file and retweet this post ;)

How To: Show Off Your Social Counters in WordPress

You know it’s all about social these days, and this post is about showing off how social you are on your WordPress website. I’m sure you’re using tonnes of social networks and all of them have friends, followers, fans and subscribers metrics, but let’s start from simple: Twitter, Facebook and RSS.

We’ll write code in this post, and you may ask me why. Of course there are loads of copy-paste javascript widgets available, but the first problem I encountered with those is they’re all different! What we’re going to do here is grab the numbers on the server, so then you’ll be able to display them however you like, with your own icons and captions.

I wrote a couple of posts on this topic last year:

We’ll be using some of those snippets in our code today, together with a few additions for Twitter followers count and RSS subscribers too. We will also adapt these to WordPress. Okay, enough talk, let’s get to the coding!

Icons Credit: Drink Web 2.0 by Bruno Maia

Twitter Followers Count

This one’s quite simple, since the Twitter API allows a non-authenticated call to public users. Assuming we’ve got JSON functions available (PHP5 or JSON Services in PHP4):

public function get_twitter_followers_count( $screen_name ) {
	if ( false === ( $followers = get_transient( 'twitter-followers-count' ) ) ) {
		$response = wp_remote_get( "{$screen_name}" );

		if ( is_wp_error( $response ) ) {
			$followers = 91;
		} else {
			$json = json_decode( wp_remote_retrieve_body( $response ) );
			$followers = $json->followers_count;
		set_transient( 'twitter-followers-count', $followers, 60*60*24 );
	return $followers;

As you can see I’m using the Transients API to cache the followers count for 24 hours, this reduced the load on the hosting server and serves pages faster. I’ll be using transients for Facebook fans and RSS subscribers too.

Line 5 might seem a little strange, we’re explicitly setting followers to 91. We do that when there’s an error with the API call so that we don’t show off a zero-count. You can go forward and extend it to double-cache values with a get_option and set_option call so that 91 is actually a figure retrieved from Twitter API and not hard-coded. But that’s extra, I’m fine with 91 ;)

The rest seems straightforward — we parse the response using json_decode and grab the followers count. If you’re into grabbing something else, go ahead and inspect the $json object using print_r, there’s so much interesting stuff there ;)

When the followers count is in our hands, we set a transient for it, so that next time it is served from cache, and finally return the count. Simple as that ;) The usage is easy — just pass a screen name to the function and you’ll get the results, as long as it is not a protected profile.

RSS Subscribers Count

As I already mentioned, transients will be used here as well, same method. Additionally we’ll be using Feedburner’s Awareness API. In order for that to work you’ll have to have your RSS feed setup with Feedburner and the Awareness API activated. Take a look at the “AwAPI Activation and the FeedCount Chicklet” section following the link above.

public function get_rss_subscribers_count($feed_url) {
	if (false === ($subscribers = get_transient('rss-subscribers-count'))) {
		$feed_url = urlencode($feed_url);
		$response = wp_remote_get("{$feed_url}&dates=" . date('Y-m-d', strtotime('-2 days', time())));

		if (is_wp_error($response)) {
			$subscribers = 97;
		} else {
			$body = wp_remote_retrieve_body($response);
			$xml = new SimpleXMLElement($body);

			$status = $xml->attributes();

			if ($status == 'ok') {
				$subscribers = $xml->feed->entry->attributes()->circulation;
			} else {
				$subscribers = 98;

		$subscribers = (int) $subscribers;
		set_transient('rss-subscribers-count', $subscribers, 60*60*24);
	return $subscribers;

As you can see, we’re fetching the RSS feed data using the feed URL via an HTTP request to the Feedburner API. The Awareness API returns an XML object, which is then parsed using the Simple XML methods. The circulation attribute is the one we’re looking for — it indicates the approximate subscribers count.

Again, I’ve hard-coded the 98 figure there for fallback purposes, you might want to extend it. The date magic simply asks Feedburner for stats of two days ago, since it sometimes yields 0 for “today” and “yesterday”. Could be changed according to your Feedburner stats if that matters.

Finally, we’ve set the transient and returned the subscribers count, voila. Usage: pass on your Feedburner feed URL to get_rss_subscribers_count(), an integer is returned.

Facebook Fans Count

Last but definitely not least — Facebook. We’ll use the Facebook PHP SDK, I’m using version 2.1.2 which seems to be the latest stable at the time of writing. We’ll be using the Graph API way, so no more FQL queries please. Here’s the code:

public function get_facebook_fans_count($page_name) {
	if (false === ($fans = get_transient('facebook-fan-count'))) {
		$facebook = new Facebook(array(
			'appId' => 'your-application-id',
			'secret' => 'your-application-secret'

		$graph_obj = $facebook->api("/{$page_name}");
		$fans = $graph_obj['fan_count'];

		set_transient('facebook-fan-count', $fans, 60*60*24);
	return $fans;

Note, that unlike the old-fashioned way, the Graph API uses your application ID, not your API key. You can obtain these when registering a new application at the Facebook Developers page. There’s a button that says “Set Up New App” which takes you through the rest of the process.

So once your app is in place, credentials are fine and the connection is good, we use facebook’s api method to request for a page name. Try “mashable” for example.

The returned Graph object contains quite a lot of stuff, including the number of fans. Use print_r on $graph_obj to learn more. So the fan count is obtained, a transient is saved, and the number is returned.


Note that if you’re going to use these for different profiles, you’ll have to change the names of your transients to include that data, otherwise there will only be one cache. I kept the code as simple as possible here, but I’ve illustrated the extra stuff in the final source that I did. I also wrapped these up in a single class called $social, I know it’s too generic for WordPress, but I’m not writing a plugin out of this (yet). The source could be downloaded right here. Feel free to use and extend the code with your own methods for other social networks and services.

Okay well, thank you so much for reading and retweeting this, oh and by the way…

Question: what other 3-5 services would you like to get your numbers from?

Every Keyboard Needs A Share Button

I thought of this idea a few days ago and tweeted it out loud too. Today I’m taking it forward and introducing it to you, my dear readers — a brand new keyboard with a share key, conceptually of course.

Social media has exploded in the past few years, and what is social media without the ability to share stuff? Blog posts, videos, photos, whatever. Thousands of plugins, widgets and bookmarklets have been developed, which allow you to share the web page you’re viewing, a YouTube video or a screenshot of your desktop. Good, but it’s time to take this to the next level, directly on the keyboard. Multimedia keyboards have been around for over a decade and heck, nobody uses them except that popular “mute” button!

You don’t mute your speakers every day though, but what you do everyday is share. You share lot’s and lot’s of different content with your friends, family, co-workers and the rest of the world. You tweet, you digg, you stumble and you reddit, you facebook, you quora and you vkontakte for Christ’s sake ;) Wouldn’t it be wonderful if there was a key for that? I mean there are 12 freakin’ function keys (F1-F12) — those are pretty useless! And the scroll lock? What about a certain “Alt Gr”? I have never, ever pressed that! Nobody even knows what “Gr” is! Here:

Share Button

See? That was easy! Let’s call it the Social Keyboard! And there’s more!

What Happens When the Share Key is Pressed?

Good question, glad you asked! What happens when you press, say Ctrl+F? That’s right — depends on what you’re currently doing, i.e. which application is active. You’ll get the search bar in Google Chrome and other browsers; you’ll get a search dialog in a word processing application; you’ll get the file search in your file explorer; Google Docs will cover up with it’s own search box; and you’ll probably get nothing if you’re running Minesweeper or whatever.

So the action is based on the application, where some applications might delegate the action. For instance, if you’re running Photoshop and hit the Share button, your current image will be saved and uploaded to Dribbble, Forrst or whatever you pick. If you’re browsing your hard drive, pick a photo and hit Share, the file will be uploaded to Twitpic or Flickr. If you’re listening to a song in your favorite player and hit Share, it’ll create an entry on your or account. What about the browser? Well, this needs a separate paragraph.

If you hit Share in your browser, your browser will either delegate the action to the current web page that can intercept the key press using JavaScript, or if that’s unavailable, it’ll handle the sharing action itself — publish a link to the current page to Twitter, Facebook, Digg or whatever. Voila! Below is a set of screenshots I prepared to illustrate all that I wrote above.


There is a browser for social media (I’m talking about RockMelt), so why can’t there be a social keyboard? I’m tired of all these bookmarklets, widgets and apps that help me (or at least try to) share stuff online. A simple key on my keyboard will make life so much easier!

I know there’s quite a lot of work involved in developing such a product, drivers and everything, and then get software and web developers to adopt it, but hey, you did it with the multimedia keyboards! I know they turned out to be pretty useless but please, give it another shot. Sony, Logitech, Genius, Microsoft, Defender, or perhaps Apple? Who’ll be the first?

Thank you for reading. Bye bye!

Dave Winer's Commenting Proposal

Based on a recent post by Dave Winer (RSS pioneer) called Proposal: A new kind of blog comment system. And a follow up has been posted here: Why I like comments. Briefly, the idea behind the new commenting system it is the following:

  1. Disable commenting on posts older than 24 hours
  2. Comments are invisible to other commenters until the 24 hour period expires
  3. Commenters can edit their comments during the period
  4. Length limit of 1000 characters

So jumping back to my mail inbox and the comments folder with over a 100 unread and unresponded (and spam) messages, I decided to give it a go, starting from point one. I fully agree with Dave about the reasoning behind all the points, but personally think that 24 hours is too harsh, so I started off with 7 days, keeping in mind that this has to be decreased.

This means that when a post is published, you (my readers) have 7 days to comment. Don’t worry, commenting on support pages for my WordPress plugins has not been switched off.

I’ll hopefully be implementing the rest of the features throughout September, and will keep you posted on Twitter (@kovshenin). Cheers!

Update: Due to some temporary WordPress limitations, I had to switch comments back on for a while. Will probably write a short snippet on how to achieve such functionality without having to do it from within your WordPress settings, which applies to pages as well.

Now with the Facebook Like Button!

Obviously, the Facebook Like button is one you’d like to implement inside your blog, website or whatsoever. I did too, although I am quite late as everyone has theirs for ages, but why not share some thoughts about it and the whole social widgets riot? As we all know (or maybe suspect) the web is going social, and what value is your blog if your readers can’t share your article with their friends with a single click of a button?

Facebook’s gone wild for the last few months. They keep rolling out new features, extending their functionality, and allowing developers and website owners implement those features into their own websites. Of course Facebook’s not the only one with their funky F8 conference, the Javascript SDK and the Social Graph API, as Twitter introduced their @Anywhere platform at the SXSW conference. And what about Digg? Google Buzz? I can go on forever, but all these new features have some things in common:

  • The code is bullet-proof (with a few exceptions)
  • You don’t need third-party services such as Tweet Meme, etc
  • Everything’s well documented in several languages
  • They’re all incredibly easy to use and maintain

Right. Who needs those extra WordPress plugins when you can simply copy and paste a few lines of code into your sources? As long as you have a little bit of general HTML knowledge you’ll be fine. If you’re a developer though, you’ll find all these extras much more interesting than an average person. I’ll keep this post closer to what Facebook has to offer, but the thoughts are fair for others too.

If you’re into the Facebook Platform, then you must have had some experience with FBML, iframe coding for Facebook and Facebook Connect. After Facebook rolled out their official PHP library, things began to make more sense, as you don’t have to spend too much time reading the specs to their API, everything’s done for you and wrapped into a set of classes, well documented and ready for use. Amazing!

Now, let’s drop the PHP stuff and talk about javascript for a while. Facebook’s got a Javascript SDK, and the best part of it is that you don’t have to read at all! There it is, right on the homepage, a short snippet of javascript code, ready to be copy-pasted onto your website, and voila! You’re now officially pimped! And ..? And yes, returning back to our Facebook Like button, it’ll take you less than 3 seconds to install it as well as all the other sexy widgets.

The Facebook Like Plugin page is full of text for those of you who like to read, but just by looking at the form, it’ll take you 2 seconds to configure it, and one to grab the code in FBML. If there’s somebody who didn’t quite get it, here’s a snippet with the complete Like button:

<div id="body">
<!-- My FBML goes here -->
<!-- Facebook Javascript SDK -->
<div id="fb-root"></div>
    window.fbAsyncInit = function() {
        FB.init({appId: 'your_app_id', status: true, cookie: true, xfbml: true});
    (function() {
        var e = document.createElement('script'); e.async = true;
        e.src = document.location.protocol + '//';

What on earth could be easier than that? Hello World? ;)

Now that you’re boosted with the Facebook Javascript SDK, you can go on and grab some other sweet plugins such as the Activity Feed, Comments, Friendpile and the rest. Experiment with the UI, sizing and positioning and you should be able to fit the widgets anywhere on your website. P.S. The Facebook Like button’s minimum width is 90 pixels.

You won’t (or at least shouldn’t) have any trouble installing other social widgets onto your website, including Twitter, Digg and Buzz. There are tonnes of articles out there that explain the whole process step by step, but if you’re experienced enough, you’ll be fine just by scanning through the code.. Hope you didn’t scan my article that way ;)

Anyways, the bottom line is that Facebook (and everyone else) are doing quite good at providing tools to fulfill your website with the social juice available. Oh, and don’t forget to “Like” this post, and of course retweet. Cheers!

WordPress 3.0, Social Media in Russia, Hiring & Coffee

So, there’s quite some interesting stuff going on around here and let’s of course begin with WordPress. Yes, WordPress 3.0 has been released, some blog posts of mine got even more visibility and I’ve been interviewed on the WordCast Conversations show – thank you so much @kymhuynh and @lorelleonwp.

I don’t know when the show will air, but Kym promised to let me know the scheduled date as soon as they set one, so stay tuned for an update – I’ll write a separate post for that one.

Russian President Dmitry Medvedev is in the US, visiting Apple, Twitter & others from the Silicon Valley. He finally got his Twitter accounts: @KremlinRussia and @KremlinRussia_E (for the English speaking ones). Both accounts are verified and following @BarackObama ;) He gained over 30k followers within two days and is now using his own URL trimming service –! He also has some quite cool photos of the Twitter office, the Apple office and Steve Jobs ;)

Speaking about photos, a few days ago I came across a real New York City Taxi here in Moscow. It was parked in Lyublino (South-East), had no number plates, and disappeared after a couple of days. I guess it was some Russian oligarch living in NYC who got drunk on Friday and decided to visit his relatives in Moscow during the weekend :D Oh well ..

NYC Cab in Moscow

My apologies, this was shot from my iPhone, not the best size and quality. View the full photo here. So, as promised by the title, a short list of facts I found interesting this week, mainly about hiring:

  • MoiKrug (Russian Linked in clone) is not that bad.
  • & ARE that bad.
  • Luxoft know who I am and have my contact details.
  • It’s a good idea to speak to candidates over the phone for 15-20 minutes before inviting them over for a job interview. 60% are usually dropped out.
  • SugarCRM is boring, BaseCamp too. Microsoft Project rocks.
  • Russian e-payment system does not work.
  • Russian 1C is not the only ERP platform used in Russia. Some prefer Microsoft Dynamics NAV (formerly called Navision).
  • MVC and Zend Framework should be mastered immediately.
  • There are problems accessing Gmail from certain regions in Turkey.
  • Coffee without milk is okay, until you start drinking it everyday.

That’s about it for this week and yes, we’re still looking for young and talented PHP developers and web designers willing to work in Moscow startup. Feel free to contact me for more information about the job offers. Cheers, and have a great weekend!

Brand Your Tweets with Twitter Anywhere

What we’ve seen so far at Twitter @Anywhere is amazing! I’ve seen tonnes of websites implement Twitter functionality to ther websites without any hassle and it also seems to work well! Now that the documentation is being arranged, everything seems clear enough, this is yet another way of branded tweeting!

Branded tweeting? Huh? Well, this is a topic covered quite sime time ago, when companies (and individuals) wrote specific Twitter clients via the available OAuth libraries, that would send out tweets marked “via application”, where “application” could be the name of the company, linking to their website.

Such applications were standalone (Visual Basic, C#, etc) or web-based (perl, php), and some of them were not only meant to tweet, but sometimes looked like a full-feature Twitter client. But, the time has changed.

In order to brand the tweets, all you have to do now is register your application to use OAuth at and copy-paste an @anywhere snippet called tweetbox, somewhere on your website. It could also be a private area (or even a local html page), doesn’t matter.

The engineers at Twitter have worked out all the OAuth routine for you, and what you’re left with is an awesome tweet box, just like on, through which tweets will be sent out “branded”, i.e. containing your application name in the “via …” clause.

This is certainly easier than how we had to do it earlier, and I’m expecting a huge impact on the Twitter clients list, which will increase dramatically, as more and more companies and individuals would like to see their names in the client section of every tweet. Of course this move is quite serious, as it may destroy some of the statistics that Twitter gather, where “web” used to take the lead.

Of course the @anywhere tweetbox is not a fully-functional Twitter client and we’d still like to use TweetDeck, Seesmic and other major ones for our convenience. Then again, what if the major ones start offering (perhaps not for free) branded tweeting themselves? I think that would be against their company policy and would result in a total mess ;)

P.S. You can now chirp me, which took me a few minutes to build with Twitter @Anywhere.


RIP Twitter Will Launch Its Own Shortener

As mentioned on TechCrunch, Evan Willams at Chirp confirmed that Twitter will sooner or later launch its own URL shortener, probably called or (both owned by Twitter). Well, let’s just hope that they do a good job at this. I’m talking about the future functionality and the links riot going on for quite a while.

It seems that more and more people and businesses are branding their Twitter accounts by using their own shortening services – by Facebook, by Google, etc. We all hope that short URLs posted to Twitter will not be re-shortened using Twitter’s new service. This sometimes happens with the current shortening capabilities of Twitter, short links are sometimes re-shortened using, causing a double redirect, which is awkward.

Statistics and analytics is another good part of Hope they don’t miss that too, which might also be a chance to get some extra cash in, offering businesses detailed analytics. But one issue still persists, on each and every URL shortener – rev canonical and shortlink HTTP headers.

If a page already has a short link assigned and perhaps branded, then it is the one that should be returned, without shortening the original. Of course you may want to run some checks to see if the short link is short enough, valid, etc. And this may be the confusing part – what if the short link provided by rev canonical or HTTP headers disappears? Well, how about “what if the page disappears?” ;)

Maybe such functionality may be in advanced settings for each Twitter account, but I’d really love if Twitter used my own short URLs when I post stuff from my blog instead of or their future ones. I got my own analytics set up and I’m pretty sure everybody does, so why not give us a chance to brand ourselves a tiny bit?

Well, if that doesn’t work out then I’ll have to continue writing my own desktop/mobile Twitter client, or keep sending tickets to TweetDeck and Seesmic. How can we talk about HTML5 if things aren’t yet sorted out with rel and rev canonical. And what about IE6? Heh ;) Don’t mind me, I’m just thinking out loud.. Cheers!