Display Facebook Page Text Count On Your Blog

If you have a Facebook page (and if you don’t then why not?) then you might want to show off how many fans you have to the readers and visitors of your blog. Here is a piece of code that will display a text count without the need to activate another plugin.

Simply stick the code below into one of your theme files (Sidebar, Header, Footer, etc), or in a PHP widget (you’ll need a PHP widget plugin), where you wish for it to be displayed. This will not work if you stick it in a Text widget.

There is a space just before the ?, please remove it and add a space after it instead.

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

Don’t forget to replace “YOUR PAGE-ID” with the ID of your Facebook Page.

Dean Saliba

Dean Saliba is a freelance writer, professional blogger, media enthusiast, dirty football player and huge professional wrestling fan who covers a wide range of subjects and niches including, making money online, traffic generating, pro wrestling, blog reviews, football, how-to guides, music, internet marketing and more.


Comments are closed.