Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function total_number_comment() {
- global $post;
- $url = get_permalink($post->ID);
- $filecontent = file_get_contents('https://graph.facebook.com/?ids='.$url);
- $json = json_decode($filecontent);
- $fb_count = $json->$url->comments;
- if ($fb_count == 0 || !isset($fb_count)) {
- $fb_count = 0;
- }
- $wp_count = (int)get_comments_number();
- echo $fb_count + $wp_count;
- }
- <script>
- window.fbAsyncInit = function() {
- FB.init({
- appId : 'ID',
- xfbml : true,
- version : 'v2.4'
- });
- };
- (function(d, s, id){
- var js, fjs = d.getElementsByTagName(s)[0];
- if (d.getElementById(id)) {return;}
- js = d.createElement(s); js.id = id;
- js.src = "//connect.facebook.net/en_US/sdk.js";
- fjs.parentNode.insertBefore(js, fjs);
- }(document, 'script', 'facebook-jssdk'));
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement