Top Ad unit 728 × 90

. Display Twitter Follower Count as Text

There are users who absolutely hate buttons like Feedburner buttons or Twittercounter buttons. Are you one of them? Do you want to display your twitter count as text, so it blends in to your new custom design? Well then this hack is just for you.
First you would need to create a file twitter.php and paste the following code in there:
01<?php
02$tw = get_option("twitterfollowerscount");
03if ($tw['lastcheck'] < ( mktime() – 3600 ) )
04{
05$xml=file_get_contents('http://twitter.com/users/show.xml?screen_name=wpbeginner');
06if (preg_match('/followers_count>(.*)</',$xml,$match)!=0) {
07$tw['count'] = $match[1];
08}
09$tw['lastcheck'] = mktime();
10update_option("twitterfollowerscount",$tw);
11}
12echo $tw['count'];
13?>
Make sure to replace wpbeginner with your twitter name.
Then Simply place this code anywhere you want to display this:
1<?php include("twitter.php"); ?>
. Display Twitter Follower Count as Text Reviewed by Unknown on 9:26 PM Rating: 5

No comments:

All Rights Reserved by Boca Raton Real Estate © 2014 - 2015
Powered By Blogger, Designed by Sweetheme

Contact Form

Name

Email *

Message *

Powered by Blogger.