Display number of Facebook fans in full text on your WordPress blog

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 :

	$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

Subscribe to WPDEN


  • http://www.osmanleiva.com leiva

    any demo? can I show: Join our n fans on facebook!?

    • http://wpden.net/ Ritesh Sanap

      Well it completely depends on your creativity the code provided is the base code

      • http://www.osmanleiva.com leiva
        • http://wpden.net/ Ritesh Sanap

          Looks Great, but might look more awesome when using on a WP site in action