Facebook plugin for wordpress – No support from facebook? :-(

Being a hobbyist and not a professional, I have spent lots and lots of tireless days and sleepless nights, trying to integrate the social plugin i.e. facebook for wordpress, offered by facebook, into my blog. All of us who manage their webpages using wordpress know how difficult is it to take approval of various actions and settings from facebook, prior to final implementation on websites.

The login flow using facebook, which was working fine till some time ago, has started throwing an error while I try to login using the administrators account, asking me to take approval for some role permission. When I was going through the documentation for the same I just stumbled upon a post by facebook, that the social plugin, i.e. facebook for wordpress is no longer supported by facebook.

Now, this brings me to feel that facebook has ditched me by withdrawing their support and m feeling bad for all that effort which I have put in for integrating my wordpress blog with facebook.

How many of you also feel the same. I request you all to share your feelings…….

Display Combined Comments Count Of Facebook and WordPress Comments On Blog

Our team was struggling to find out a way to display the combined comments count of Facebook and WordPress Commenting system simultaneously on our Blog site www.preetisblog.com.

In order to show comments from both the WordPress and Facebook Commenting system simultaneously, we had installed the Facebook for WordPress plugin and we had disabled comments, yeah we repeat disabled the comments from the plugin. And we had manually inserted facebook comments box in the footer of the page using a text widget, so that we could have comments from both the systems simultaneously on our page/ posts.

Now though we had the comments from both systems, but the comments count shown at various places was that from only the WordPress Comments system, for example in the bubbles showing comments count in theme twenty eleven or number of replies below the posts. Thus, it gave a very wrong impression to a new visitor to the site as regards to the number of comments. To solve this we tried to search the internet but we could not get a simple and viable solution.

Thus as we wanted to correct this, we found a very simple solution, which we are sharing here for all fellow WordPress Administrators/ Designers. Just copy and paste the code below at the end of “functions.php” file of your active theme and you will see the combined count of comments from Facebook and WordPress at all places, wherever your theme shows the comments count. We will request all fellow developers to share this post to make the life of our good friends in similar jobs easier.


/**********************************************************
*Function to display the combined comments count of facebook
*and WordPress Comments Works with Facebook for wordpress
*plugin installed. Just copy and paste this code at the
*end of the functions.php file of your active theme or into
*that of your child theme.
*Written by www.Preetisblog.com
*We may extend this to comments of other social
*plugins like google, twitter etc graduallly.
**************************************************************/
add_filter( 'get_comments_number', 'full_comment_count_preetisblog' );
// Get combined FB and WordPress comment count
function full_comment_count_preetisblog() {
global $post;
$url = get_permalink($post->ID);
global $facebook;
$cmnts = $facebook->api('?ids='.$url,'GET');
$fbcount = $cmnts[$url]['comments'];
$post_id = $post->ID;
$mypost = get_post($post_id);
if ( ! isset($mypost->comment_count) )
$wpCount = 0;
else
$wpCount = $mypost->comment_count;
$realCount = $fbcount + $wpCount;
if ($realCount == 0 || !isset($realCount)) {
$realCount = 0;
}

return $realCount;
}