I am using the Facebook comments plugin on WordPress and the comments box is working fine but I want to access the number of counts on the index page and on single pages. On the pages, the Facebook Javascript is loaded on the pages.
Here's the code I used:
<fb:comments-count href=<?php echo get_permalink() ?>/></fb:comments-count> comments
But it doesn't count the FB comments.
Is there a simple code that let me retrieve the number of comment counts?
Thanks,
The comments often don't appear here :
Instead they appear well in
Hence the value of the final solution.
Include this function somewhere in your template file :
use it like this in your homepage or wherever
Had the same problem, that function worked for me... if you get an error... try reading this.
This works for me :
Just put this function in functions.php and pass the post url to function fb_comment_count wherever you call it on your theme files
}
Answer by ifennec seems fine, but actually is not working (facebook maybe changed something and now is only returning the number of shares).
You could try to get all the comments:
And count all:
This is just a fix until facebook decides to read the FAQ about fb:comments-count, and discovers it's not working :) (http://developers.facebook.com/docs/reference/plugins/comments/ yeah, awesome comments).
By the way, I applied the function in Drupal 7 :) Thank you very much ifennec, you showed me the way.
This is resolved.
The problem was that I was using 'url' than a 'href' attribute in my case.