Facebook Like Count

I’ve successfully integrated a Facebook Like button to WordPress based website. The Facebook Like button is shown only on single posts. However, I would like to output how many times a post is being liked on the front page of my site without showing the actual like button. A simple number output is what I’m after.

I’ve been reading Facebook documentation as well some tutorials that partly deal with this issue, but haven’t got anywhere so far.

Related posts

Leave a Reply

4 comments

  1. Paste this function in your theme functions.php file and save the file.

    function bfan() {
        $pageID = 'Page ID/Page Vanity URL';
        $info = json_decode(file_get_contents('http://graph.facebook.com/' . $pageID));
        echo $info->likes;
    }
    

    Then you can call the function.

    You will need to know your facebook page ID or facebook page name,then just substitute it in the code above.

    Hope this helps you out.

  2. If you want see the evolution of your Top Social Stories in your WordPress, you can use this plugin that tracks data from Facebook, Twitter and Google+ for each post and globally for all the links of your blog and export these data also in custom field to use them in your theme.

    UPDATE: this plugin now tracks also Pinterest, Linkedin and Vkontakte and has many new features.