Getting facebook fan counts to work with Momizat multinews

 (Read 1587 times)


  • Administrator
  • Hero Member
  • *****
  • Posts: 1549
    • The Jucktion
As you might have encountered on our home page, that our facebook count for the facebook page is displayed wrong. and the theme developers are nowhere to be seen. I hoped to see some updates to not delve into the code to fix it which might break in an update. But with no updates for a long time I decided to check the issue myself.


After checking the error log and the code, I found that the theme is using an old declaration to get the fan counts for facebook.

You will have to edit the file:
Code: [Select]
Code: [Select]
$data = wp_remote_get('' . $page_id .'?fields=likes,link&access_token='.$facebook_access_token);

Code: [Select]
$data = wp_remote_get('' . $page_id .'?fields=fan_count,link&access_token='.$facebook_access_token);
Code: [Select]
        $count = isset($json['likes']) ? intval($json['likes']) : 0;
Code: [Select]
        $count = isset($json['fan_count']) ? intval($json['fan_count']) : 0;

The likes are stored temporarily on transient options which you will have to clear after you finish editing the files. I use WPSweep to get those cleaned and it worked perfectly.

Other counters may still have errors, I may check if anyone has issues.

I hope this helps someone


Best Affiliate Program