If you have a Facebook fan page for your blog, you might want to display how many facebook fans you have. Today’s I will help you to get your Facebook fan count, in full text!
For displaying Facebook fan Count you just have to add the below code anywhere in your theme :
<?php $page_id = "YOUR PAGE-ID"; $xml = @simplexml_load_file("http://api.facebook.com/restserver.php?method=facebook.fql.query&query=SELECT%20fan_count%20FROM%20page%20WHERE%20page_id=".$page_id."") or die ("a lot"); $fans = $xml->page->fan_count; echo $fans; ?>
Change the YOUR PAGE-ID
on line 2
leiva says
any demo? can I show: Join our n fans on facebook!?
Ritesh Sanap says
Well it completely depends on your creativity the code provided is the base code
leiva says
heres my demo: http://osmanleiva.com/fans.php
Ritesh Sanap says
Looks Great, but might look more awesome when using on a WP site in action