How To Display The Count Of Your Facebook Fans Page In Plain Text
05.01.11 by Jerome in Tutorials
Today I’m going to show you how to display the number of followers you have on your Facebook fan page, in plain text, in your WordPress blog. You’ll see it’s quite simple and should take you only 15 to 20 minutes to implement.
Step 1
Login to your Facebook account and signup for a developer account to get your API Key.
Click the Set Up New Application link –> Select an application name –> Agree to the Facebook terms and go to the next step.
Step 2
Copy and paste your API Key and Application Secret code into notepad.

Step 3
Go to your Facebook Fan Page and get the ID of your Fan page, simply by editing your page. Get the last digit of your page URL.
http://www.facebook.com/pages/edit/?id=PAGEIDNUMBER
Step 4
Download the Facebook API PHP SDK file and under the scr folder get the file named facebook.php and place it in the root of your website.
Step 5
To finish, place this code below where you want to display it and replace the text in capital letters with your own ID’s:
<?php require_once('facebook.php'); $facebook = new Facebook(array( 'appId' => 'ADD YOUR OWN FACEBOOK APPLICATION ID', 'secret' => 'ADD YOUR OWN SECRET KEY', 'cookie' => true, )); $result = $facebook->api(array( 'method' => 'fql.query', 'query' => 'select fan_count from page where page_id = ADD YOUR OWN FACEBOOK FANPAGE ID;' )); $fb_fans = $result[0]['fan_count']; ?> <p><?php echo number_format($fb_fans); ?> Facebook Followers</p>

Stay in Touch with us on Facebook
No related posts.
-
http://ineeddiscipline.com Dean Saliba
-
http://www.pimpmywordpress.com PimpMyWordPress





