As you begin to build a build of a subscriber, it may become desirable to start displaying your follower numbers from several avenues, such as your Twitter followers, Facebook fans or your RSS subscribers. It lends some credibility to your site, showing that you’ve already built a decent reader base.
I decided that it was about time that I did this on Do It With WordPress, for the experience (and this tutorial) if nothing else. It actually wasn’t as easy to come up with this information as I had hoped, so I ended up largely crafting these snippets myself to get it just the way I wanted.
To display your Twitter followers as plain text in your theme, you first need to insert this code into your functionality plugin:
There’s only one thing to configure in this snippet; sometimes retrieving the value will fail, so I’ve created a failsafe (512), which it will resort to in the event of not being to retrieve the actual number. You could either use an approximate number of followers, or create a little error message. It’s up to you.
Then to actually display the number in your theme, edit the theme file where the number needs to appear and insert the following snippet in the correct location, being sure to use the Twitter username that you’re actually interested in (instead of daclements):
To get the number of Facebook fans from your Facebook fan page, we take a similar approach; initially, you need to paste the following snippet into your functionality plugin (thanks to Kevin Chard for the basis of this snippet):
In this instance, there’s nothing to edit in the snippet above. Once that’s in place, paste the following snippet wherever you want the count to appear. You’ll need to switch out the fan page number for your own page, which can be found in the URL of your Facebook fan page:
RSS (FeedBurner) Subscribers
If you run your RSS feed through FeedBurner, you can use this little snippet to show the number of subscribers you have. First of all, you need to go into FeedBurner and make sure that you have the Awareness API activated; without it, you won’t be able to get the subscriber count.
Once that’s handled, paste the following snippet into your functionality plugin:
Then, in order to show off your subscriber count, just paste the following little snippet in the relevant theme file and change the FeedBurner ID (mine is wanderingbrit in the following snippet) so that you’re taking the number from your own RSS feed instead of mine:
So, that’s it. Pretty simple huh? What other services would you be interested in getting such stats from? Would you find it beneficial to incorporate this into a plugin (I might consider it)?
UPDATE: I found a decent plugin which largely achieves the same functionality. You need to create a widget and use a shortcode to display each value, but if all of this code scares you, it’s a viable alternative. It hasn’t been updated in a while, but I tested it on 3.2.1 and it’s working just fine. Download Subscribers Text Counter