Show Twitter Followers Count in WordPress

This WordPress snippet grabs and displays the number of Twitter followers the specified user has.

Add this to your template file where you want it to be displayed.
*Change USERNAME to the Twitter Username you want to get the stats from.

     $twit = file_get_contents('');
     $begin = '<followers_count>'; $end = '</followers_count>';
     $page = $twit;
     $parts = explode($begin,$page);
     $page = $parts[1];
     $parts = explode($end,$page);
     $tcount = $parts[0];
     if($tcount == '') { $tcount = '0'; }
    echo '<b> '.$tcount.' </b> followers.';

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Do NOT follow this link or you will be banned from the site!
%d bloggers like this: