Code for displaying number of Facebook fans in WordPress

In order to display the number of Facebook fans in a WordPress site just copy and paste below code to your WordPress theme. Don’t forgot to change PAGE-ID to your Facebook fan page ID.

 
<?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 ("oops");
    $fans = $xml->page->fan_count;
    echo $fans;
 
?>

Related posts:

HTML5 page structure

HTML5 offers more powerful structure comparing to older versions of Html. There are many new …


Partner with Us

We are providing an exclusive partnership offer to individuals and companies who are interested in setting up their own web design & development company. For more information about how to partner with us, please contact us