If you've created a Facebook page for your blog as an alternative form subscription may also be interested in your blog to display the amount of fans that this is so, encourage more people to subscribe.
What good have as many fans in plain text? That is much more flexible to adapt and customize the design of your blog widgets that Facebook offers. The ultimate goal is to make it more attractive subscription to the Facebook page of your blog.
to get the number of fans of a Facebook page is necessary to invoke API and get some data easily:
1. Facebook enters your mind the application developer. (If you have developer account, just get one.)
2. Now from the developer see the button "Configure a new application." We give a name and accept the terms of Facebook. This for an API key and a secret number that gives access to the number of fans.
Then, the data used below are:
3. Now you need to get the ID fans page on Facebook, for this only entered the page and the link "Edit Page" the sidebar is the URL with the ID of the page. Is something like:
http://www.facebook.com/pages/edit/?id=123456789012El final number is the ID and the last data necessary to obtain the number of fans.
4. Now, to work with this data is necessary to make use of the library facebook.php. Facebook PHP SDK download and put the file in the root facebook.php the directory where you will use (in WordPress, the theme directory).
5. Finally, to show the number of fans, open the php file where you want displayed (in WordPress might be sidebar.php) and paste the following code:
'ID_de_aplicación'
'secret' => 'Número_secreto'
'cookie' => true,
));
$ result = $ facebook- > api (array (
'method' => 'fql.query'
'query' => 'select fan_count from page WHERE page_id = ID_de_página;'
));
fb_fans = $ $ result [0] ['fan_count'];
?>
and replaces the previous code:
■ by the ID number of the application created in step 2. ■
Número_secreto by the secret number of the application created in step 2. ■
ID_de_página by the number of ID fan page seen in step 3.
With this we have the number of fans in plain text that can be served with a style message "We have 800 fans become a fan too!" and a link to the Facebook page.
based article How to Display Facebook Fan Hongkiat Count in Text.
0 comments:
Post a Comment