How to: Display twitter followers count on your blog/website

It is great that you can have a twitter follower button on your website or blog. Some bloggers or developers, using heavy plugins to show their twitter followers count on their website.

In this note, I will show you how you can display the total number of twitter followers as text on your blog or websites.

I really don’t like to install heavy plugins, that do little things like this. So decide to create a simple script for display the followers count. Yeah, its’s done. This code is very simple. I think, it’ll be very helpful for you.

step 1: Adding code to your site

This is the main function to get your twitter followers count. Copy and paste it your common functions coded file like config.php, main_functions.php, engin.php etc.. For an example: WordPress uses the function.php file to write common custom functions for particular themes. If you are a WordPress blogger open functions.php, paste this script and save the file.

step 2: Display Followers count

Now simply call that function any where you want in your theme files. For an example: I like to show my twitter followers count on my blog’s header, I simply calling that function with my twitter user name in header.php file, like this.

Isn’t it simple?..

Note: Please ask your host provider to enable file_get_contents() feature in your server, if you getting an error like this,

Warning: file_get_contents() [function.file-get-contents]: URL file-access is disabled in the server configuration in /[…..]/t_count/index.php on line 6

Happy blogging :)