Want to add the Facebook Like Count in WordPress? Paste this function in your theme functions.php file and save the file.
1 2 3 4 5 | function bfan() { $pageID = 'Page ID/Page Vanity URL'; $info = json_decode(file_get_contents('http://graph.facebook.com/' . $pageID)); echo $info->likes; } |
You will need to know your facebook page ID or facebook page name, then just substitute it in the code above.
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.