How to show the Twitter Followers Count on wordpress widget

We all are having the twitter account. If we want to show how much people following you on twitter then just use following code.

Open your sidebar.php file and just copy paste the following code.

First you would need to create a file twitter.php and paste the following code in there:

<?php

//This xml file will return the all user information about from twitter acctount
$xml=file_get_contents(‘http://twitter.com/users/show.xml?screen_name=wordpressapi’);
if (preg_match(‘/followers_count>(.*)</’,$xml,$match)!=0) {
$twitter_follower_count['count'] = $match[1];

// this will show the twitter followers count
echo $twitter_follower_count['count'];
?>

WordPressapi is my twitter username. So you can change it your username.

You may like following Articles!

11 thoughts on “How to show the Twitter Followers Count on wordpress widget

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>