Advertisement
utnalove

fb comments 2

May 1st, 2013
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.56 KB | None | 0 0
  1. function full_comment_count() {
  2. global $post;
  3. $url = get_permalink($post->ID);
  4.  
  5. $filecontent = file_get_contents('https://graph.facebook.com/?ids=' . $url);
  6. $json = json_decode($filecontent);
  7. $id = $json->$url->id;
  8. $comments = file_get_contents('https://graph.facebook.com/' . $id . '/comments?summary=true');
  9. $jsoncomments = json_decode($comments);
  10. var_dump($comments);
  11. $count = $json->$url->comments;
  12. $wpCount = get_comments_number();
  13. $realCount = $count + $wpCount;
  14. if ($realCount == 0 || !isset($realCount)) {
  15.     $realCount = 0;
  16. }
  17. return $realCount;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement