There's so many social networks that we need to work with now

Display Number of Twitter, Facebook and RSS Subscribers

| 13 Comments

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.

Twitter followers

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):

Facebook Fans

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):

Facebook Fan Page IDIn 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

Categories: Code & Snippets, Plugins, Social Media | Permalink

What next?

Hire me

If you couldn't quite manage this yourself, find it too intimidating, or just don't have the time to do it, you can always hire Dave to do it. Please get in touch so that we can discuss your needs.

Leave a comment

If you have a question, update, or comment about the tutorial, please leave a comment. I try and respond to every comment, though it may take a few days, so please check back soon.

Let a WordPress Expert help you

Do you want to try this, but feel like you need a helping hand, in case something goes wrong? My service, The WP Butler, gives you access to WordPress expertise whenever you need it. Better yet, I'll keep your site backed up, updated and secure, so that you don't have to worry about it. It's all part of the service. Use coupon DIWW and save 15% on all plans.

Visit The WP Butler

Author:

Dave has been tinkering with WordPress for many years, and he now shares his WordPress knowledge here on Do It WIth WordPress to help others realise its impressive power. He can also be hired to help with your WordPress needs. Dave, who is British, is married to his best friend, Marti, with whom he has a beautiful daughter, Ellie. When he's not dabbling with WordPress, he's probably eating Triscuits or hummus, watching an indie film or British TV show, spending time with friends or family, or exploring the world.

13 Comments

  1. Do you know a way of getting the Google Reader stats instead of feedburner. I don’t like feedburner (though I do admit they have gotten rid of some of the worst parts) so I don’t use it. I can see my stats for Google Reader subscribers by manually looking (search to add feeds and it shows you feeds with the number of subscribers via Google Reader).

  2. Just a little tip if your embarrassed to display your RSS subscriber count because of a low number of subscribers, if you use AWeber you can connect that with your feedburner account and all of your AWeber subscribers will count as RSS subscribers. If you have a decent sized list that should really bump up your RSS subscriber count. :)

  3. I’d always wondered how that was done.

    Thought I have to wonder, and ask. Is there any point to it or is it just a way of showing off?

    I have a feeling that showing that people are already following you on these services will encourage others to join…I have to do some research on this!

    • Well, there’s definitely two ways to view it and I can certainly see it from both sides. It could certainly be perceived as showing off, but looking at it another way, it is a way of giving potential subscribers that you’ve got a sizeable following, which is obviously a good thing. If you’re just talking crap all the time, you clearly won’t have any followers, so it can be the thing that eases a potential subscriber into hitting the follow button.

      Thanks for your input.

  4. Hi,
    In these times, when Google seems to be valuing social interaction more in the Serps, I think it will help to have this information. I definitely feel you need to also add Google Plus 1 as it will be the most favored son as we move forward.
    Thanks,
    Jim

    • Hi Jim,

      Well, I agree that Google is tying social sites more closely to your site’s rankings and anyway to advance your online presence, whether your own site, or your social media pages can only be a positive thing, and if doing this helps convert more readers, then that’s a good thing.

  5. Thanks for this. Way better to get the facebook fan count this way and cache it and make your own facebook like image button than use the facebook js code. It slows down sites so much.

  6. This is a real double edged sword of me. You really need social interaction but the various codes take so long to load. I have to use them but they slow my site down so much. Feels like gaining with one hand and taking away with the other. Talking of Google+ I notice they rolled out vanity URLs to everyone yesterday. Handy for branding if that’s important to people.

Leave a Reply