Home / social / Display number Facebook fans
  • Display number Facebook fans

    display-number-facebook-fans

    Add this to your wordpressd theme and display the number of Facebook fans you have. Make sure to change PAGE-ID to your Facebook fan page ID.

    wordpress snippet : PHP

    <>
    <?php
    	$page_id = "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;
    ?>
    

    ( WordPress codex functions, hooks, in this snippet. )

    query,

Build a better with wpsnipp.com

Weekly snippets, themes, deals coupons roundup.

x No Thanks