you can easily show twitter follower count in your wordpress site. In this tutorial we used twitter xml api for fetching Twitter follower count using PHP. You can place the twitter count in header section or footer section or sidebar section of wordpress.
Twitter follower count using PHP in WordPress
Using following code you can print the twitter followers count.
<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php $twitter_api = file_get_contents('http://twitter.com/users/show/USERNAME.xml'); $text_output = '<followers_count>'; $end = '</followers_count>'; $page = $twitter_api; $explode_content = explode($text_output,$page); $page = $explode_content[1]; $explode_content = explode($end,$page); $twitter_followers = $explode_content[0]; if($twitter_followers == '') { $twitter_followers = '0'; } echo '<div><strong>'.$twitter_followers.' </strong> Followers</div>'; ?>
You just need to replace the your name instead of USERNAME.
i use:
$url = "http://api.twitter.com/1/users/show.json?screen_name=MYTWITTERNAME";
if( function_exists("json_decode") ) {
$cont = json_decode( file_get_contents( $url ) );
$cont = $cont->followers_count;
} else {
$social_url[$sn] = str_replace(".json", ".xml", $social_url[$sn] );
$cont = file_get_contents( $url );
$cont = substr( $cont, strpos($cont, "") + 17, strlen( $cont ) );
$cont = substr( $cont, 0, strpos($cont, "") );
}