First of all you must create file named twitter.php and paste the following code in there:
<?php
$tw = get_option("twitterfollowerscount");
if ($tw['lastcheck'] < ( mktime() – 3600 ) )
{
$xml=file_get_contents('http://twitter.com/users/show.xml?screen_name=wpboxblog');
if (preg_match('/followers_count>(.*)</',$xml,$match)!=0) {
$tw['count'] = $match[1];
}
$tw['lastcheck'] = mktime();
update_option("twitterfollowerscount",$tw);
}
echo $tw['count'];
?>
Make sure you've replaced 'wpboxblog' with your twitter username.
Now you can paste this code anywhere you want to show Twitter Follower Count as Text
<?php include("twitter.php"); ?>
0 comments:
Post a Comment