jaredatch / Shared-Counts

WordPress plugin that leverages SharedCount.com API to quickly retrieve, cache, and display various social sharing counts.
GNU General Public License v2.0
47 stars 16 forks source link

Individual Facebook like and share counts not displaying in buttons #94

Closed ADAPTiveBen closed 4 years ago

ADAPTiveBen commented 4 years ago

When using the individual Facebook like and share buttons (as opposed to the combined Facebook button) the respective like and share counts are not displayed.

The counts are saved internally, however. So, to fix, you simply need to update lines 211-215 in includes/class-shared-counts-core.php

Original code:

case 'facebook_likes': $share_count = isset( $counts['like_count'] ) ? $counts['like_count'] : '0'; break; case 'facebook_shares': $share_count = isset( $counts['share_count'] ) ? $counts['share_count'] : '0';

Updated code:

case 'facebook_likes': $share_count = isset( $counts['Facebook']['like_count'] ) ? $counts['Facebook']['like_count'] : '0'; break; case 'facebook_shares': $share_count = isset( $counts['Facebook']['share_count'] ) ? $counts['Facebook']['share_count'] : '0';

billerickson commented 4 years ago

In https://github.com/jaredatch/Shared-Counts/commit/b230d16df308ed812c715535fecb64de8c635779 we updated how Shared Counts retrieves data from Facebook. You should now received like, share, and comment data individually.

Note: Facebook now requires an access token to retrieve this data. Go to Settings > Shared Counts and click the link under the access token field for information on how to get one.