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.

About 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.

4 thoughts on “Display Facebook Page Text Count On Your Blog

    • Dean Saliba Post author

      It’s not meant as a replacement for the official widgets, it is for people who wish to only show text count, like I did Under ther “Subscribe & Follow Me” section in the sidebar. 🙂

Comments are closed.

Top