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 :

<?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

4 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>