facebook - <fb:comments-count> not working on my WordPress powered blog -


i using facebook comments plugin on wordpress , comments box working fine want access number of counts on index page , on single pages. on pages, facebook javascript loaded on pages.

here's code used: <fb:comments-count href=<?php echo get_permalink() ?>/></fb:comments-count> comments

but doesn't count fb comments.

is there simple code let me retrieve number of comment counts?

thanks,

include function somewhere in template file :

function fb_comment_count() {      global $post;     $url = get_permalink($post->id);      $filecontent = file_get_contents('https://graph.facebook.com/?ids=' . $url);     $json = json_decode($filecontent);     $count = $json->$url->comments;     if ($count == 0 || !isset($count)) {         $count = 0;     }     echo $count; } 

use in homepage or wherever

<a href="<?php the_permalink() ?>"><?php fb_comment_count() ?></a> 

had same problem, function worked me... if error... try reading this.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -