Try Tuts+ Premium, Get Cash Back!
The Ultimate Guide to Implementing Facebook Comments on your Blog

The Ultimate Guide to Implementing Facebook Comments on your Blog

Tutorial Details
  • Program: WordPress
  • Version: 3.X
  • Difficulty: Beginner
  • Estimated Completion Time: 30 Minutes

Using Facebook Comments on your blog offers your readers a way to instantaneously comment on posts, as well as to share them without having to do any work. If you think this type of commenting system will suit your audience, read on to find out how you can implement it the right way.


Step 1: Create A Facebook App

Before you actually generate the Facebook Comments code and implement it on your blog, you need to create an app for your site.

  1. Go to developers.facebook.com
  2. Click Apps
  3. Click Create New App
  4. Enter an App Display Name and Namespace

On the next screen, you’ll see your newly created app’s App ID and App Secret Key. You won’t need the secret key, but the App ID will be used later. Take note of it.

Below these keys, go ahead and fill out the Contact Email and App Domain (your blog’s domain). Go down and click on Website. Fill in the same domain that you used for the App Domain. Click Save Changes.


Step 2: Insert the Facebook Comments Code into Your Theme

In this tutorial, we’ll be implementing Facebook Comments alongside the default WordPress comment system instead of replacing it. If you want, you can head over to the Facebook Comments code generator to get the code you’ll need for inserting the comment system; however, I’ve included it here so you can just copy it. You’ll need to customize a few parts of it, however; I’ll note which parts those are for each block.

The code block below should be placed in your theme’s header.php file. Find the opening <body> tag and paste the block directly below it. On the 6th line, replace “Your App ID Here” with your App ID.

<div id="fb-root"></div>
<script>(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/all.js#xfbml=1&appId=Your App ID Here";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

While you’re still in your header.php file, go up into the <head> section and paste this block of code somewhere. It will ensure that the Facebook Commenting system on your blog posts knows it’s owned by the app you created before. Replace the “Your App ID Here” bit with your App ID (leave the quotes in place).

<meta property="fb:app_id" content="Your App ID Here"/>

The next code block should be placed in your theme’s comments.php file. Since we’re implementing Facebook Comments alongside WordPress comments, you’ll just be pasting it where you want the Facebook Comments box to appear, and you won’t be deleting any of the original code.

<div class="fb-comments" data-href="<?php the_permalink() ?>" data-num-posts="2" data-width="470" data-colorscheme="light" data-mobile="false"></div>

If you generate your Facebook Comments code from the link I gave you earlier, instead of just grabbing it from this tutorial, remember to change the data-href attribute from the original URL to <?php the_permalink() ?>, otherwise Facebook Comments won’t work.

You can also edit the data-num-posts, data-width, and data-colorscheme attributes to your liking. The first defines how many comments will be shown on each post before a user needs to click “See More”, the second defines the width of the commenting system (set it to something slightly smaller than your content area’s width), and the last is the color scheme, which can be set to “light” or “dark”.


Step 3: Display the Combined Facebook and WordPress Comment Count

Your theme most likely has several areas where it will show the number of comments there are on a post. By default, it will only show the number of WordPress comments. Since you’re implementing Facebook Comments alongside WordPress comments now, you’ll want to display the sum of the comments from both systems on each post.

To do this, first open up your theme’s functions.php file. Paste the code shown below at the bottom of the file and save it.

// Get combined FB and WordPress comment count
function full_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;
$wpCount = get_comments_number();
$realCount = $count + $wpCount;
if ($realCount == 0 || !isset($realCount)) {
    $realCount = 0;
}
return $realCount;
}

Note: This code was built off of a function written by Viceprez on the WordPress Stack Exchange. I’ve simply added a couple of lines to his original function that add in the WordPress comment count. Thanks Viceprez!

Now that you have the function added to your theme, you can use it to replace the original comment count functions used throughout your theme. In my theme, the comments are called using this code:

<?php comments_popup_link('0','1','%'); ?>

Your theme may use this function to display the comment count, or it may not. Once you’ve found whatever does display it, replace it with this code:

<?php echo full_comment_count(); ?>

There will likely be several places within your theme that you’ll need to insert this code. Here’s a list of the most common ones:

  • The comments.php file
  • Near the top of your single.php file
  • The index.php – it’ll be located in the loop that calls each post
  • Any archive files like archive.php, category.php, author.php, etc. In this, it’ll be located in the loop that calls each post as well.
  • On search.php
  • On page.php if you allow comments on pages

If the comment count in your comments.php is diplayed as a sentence, instead of just a number, you can use the code below instead of the one line function call in order to allow for words like “no comments” and “one comment”. I’ve customized mine to be more inviting – I’d recommend that you do the same instead of being generic :)

<?php 
	$commentCount = full_comment_count();
	if ( $commentCount == 0 ) {
		echo '<h5>No comments yet - you should start the discussion!</h5>';  
	} 
	else if ( $commentCount == 1 ) {
		echo '<h5>One comment so far - add yours!</h5>';
	}
	else {
		echo '<h5>' . $commentCount . ' comments so far - add yours!</h5>';	
	} 
?>

Step 4: Get Immediate Notifications of New Comments

The last part of the tutorial will show you how to get Facebook Notifications whenever someone comments on your blog.

First, you’ll need to access your comments moderation panel. You can do that by pasting the following URL into your browser, substituting “Your App ID Here” with your App ID. You might also want to add this page to your bookmarks once you’re at it.

https://developers.facebook.com/tools/comments/?id=Your App ID Here

Once you’re at your comments moderation panel, hit the Settings button in the top right corner. A window will come up, and you should see a Moderators field in the middle of it. Simply add yourself as a moderator, and you’ll start getting notications whenever someone comments on a blog post.


Conclusion

If you’ve followed all the steps in this tutorial, your blog should now have Facebook Comments implemented right alongside the default WordPress comment system. I believe this is an ideal setup, as it gives your readers the best of both worlds; Facebook Comments is probably the most convenient commenting system out there, if a reader is signed in to Facebook (they most likely are), then there’s absolutely no authentication or identification fields to fill out. They can just comment away. However, if a reader doesn’t want to use Facebook, or wants to add their link or get CommentLuv benefits, you can still let them use WordPress comments.

You also now have a comment count for each post that shows the sum of the comments from each system, and since you’re a moderator for your app, you’ll get immediate notifications of new comments. I hope you enjoy your new and improved commenting solution!

Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • Viktor

    Thanks for this great tut!
    Is it possible to implement this in a responsive design? What options are there?

    • http://collegeinfogeek.com Thomas Frank
      Author

      I don’t have much experience in responsive design, so I’m not sure how well it would work. One problem I can see is that the width of the comments box isn’t defined with CSS…

  • http://www.alamalnet.com Abdelhadi Touil

    Thanks very much for this very helpful tutorial.
    I have a question: can I display the latest comments in sidebar from both wordpress and facebook comments by time?

    • http://collegeinfogeek.com Thomas Frank
      Author

      As of right now, I don’t think there’s a good way to do that. Facebook hasn’t provided much in the way of extra commenting functionality, so the only solution I could think of would be to actually build your own plugin that would copy Facebook comments, store them locally, and pull them into a widget you’d build. It’d be pretty involved.

      Sorry there’s not a better answer yet! Hopefully Facebook will address these sort of questions soon.

      • http://www.alamalnet.com Abdelhadi Touil

        Thanks very much for your reply, Thomas. Waiting for you posts :)

  • Myke

    Combined comment count snippet – super useful.

  • http://www.offdutygamers.com Mark Christianson

    My problem with implementing a solution that depends on facebook is that you dont really retain the content and not everyone wants to deal with facebook. Ive found that so far for wordpress LiveFyre is the best and allows you to incorporate comments (which stay in your comments for WP) as well as pulls comments from twitter and facebook.

    • http://collegeinfogeek.com Thomas Frank
      Author

      LiveFyre is what I used to use. The reason I decided to switch is because you have to log in via a popup whenever you want to comment. My audience is college students, so I needed to make commenting as painless as possible. That’s why I decided to create a combination of Facebook and WordPress comments.

  • http://www.webmaster-source.com redwall_hp

    Don’t forget the part where you get less comments, because a lot of people (such as myself) refuse to comment on blogs that use Facebook comments. Not everyone wants all of their comments tied to a central identity, and I assume most of us don’t agree with the vision Zuckerberg and his sister have of an anonymity-free internet.

    Services like Disqus and IntenseDebate, which offer users multiple choices of login method are fine, but requiring a specific social network—and the most iffy one at that—simply to leave a comment? That’s going to limit the discussion in more ways than one.

    • http://collegeinfogeek.com Thomas Frank
      Author

      You bring up a very valid point – not everyone wants to have their Facebook account tied to the comments they write. That’s why the entire point of this tutorial is implementing Facebook comments right alongside the WordPress comment system, instead of replacing it entirely. It gives users a choice.

  • Dagash

    THANK U VERY MUCH …

  • Al

    I have a hobby web site setup that I would like to show Facebook comments from a hobby related national organization’s Facebook comments, rather than my own Facebook comments.

    can I use the method outlined here to do this? or am I restricted to posting comments from my own Facebook account?

    if this is not the method used, then what is the method to do this? I have seen it done, just wondering how to do it.

    Al

    • http://collegeinfogeek.com Thomas Frank
      Author

      If you’re talking about posting comments from your fan page instead of your profile, just make sure you’re using Facebook as that page instead of yourself when you post them. This is assuming you’re the moderator for the page you’re talking about.

  • Gustavo

    Moderation won’t do nothing for me.Whatever I change there won’t work and I can’t moderate comments.

    • http://collegeinfogeek.com Thomas Frank
      Author

      Did you add the meta tag with your app ID to your theme’s header, and then make yourself a moderator of your app? If you did both of those things, you may want to check the Facebook bug tracker to see if anyone else is having problems. Mine’s working just fine right now, but I had problems for the first week after I implemented it.

  • http://www.detailingblog.pl meguiars

    I used to be very pleased to seek out this web-site.I wished to thanks to your time for this wonderful learn!! I positively having fun with each little little bit of it and I’ve you bookmarked to check out new stuff you blog post.

  • http://www.sthlmwebdesign Michael

    Great tutorial, but you have some errors in your code, which are going to mess things up for people that copy and paste it. In Step 2 on the last code snippet you are missing the ? at the start or your php code that calls for the permalink.

    • Japh Thomson
      Staff

      Hi Michael, thanks for pointing that out! All fixed now :)

  • Rusty

    Hi,

    I’m afraid this doesn’t work if implemented in a standard wootheme. its tough to find out this:

    “Your theme may use this function to display the comment count, or it may not. Once you’ve found whatever does display it, replace it with this code:
    view plaincopy to clipboardprint?
    <?php echo full_comment_count(); ?> </pre>

    • http://collegeinfogeek.com Thomas Frank
      Author

      full_comment_count() is the function I wrote. The function you should look for is comments_popup_link(), although your theme may use something different. If you’re having trouble, try to envision the place in the document your comment count is in. In my theme, it’s right after the title of the article, so I just had to look for the code near where the title is called.

      • http://noahsdad.com/ Noah’s Dad

        Hey man this is great! Thanks for writing this up. I’ve been searching to find a way to do just what you wrote. I had a few quick questions I hope you (or someone else) can answer:

        1. One of the main reasons I want to implement Facebook comments on our blog is because we have a very large (and very active) Facebook group. Whenever I post a link to our blog on the Facebook page I get people commenting on both the Facebook page and the blog itself. I often tell the folks on Facebook to please visit the blog and leave the comment also since I know what they say can help other people. It’s my understanding that the way Facebook comments works is that a person can comment on the link from our Facebook page and it gets synced to the blog (and vis versa.) In other words the conversation stays as one conversation instead of two. Is that right? Can anyone chime in on well this works, and if it’s been helpful for your community?

        2. I’ve seen several plugins that saves a copy of the comment vis Facebook locally so that they can receive sep benefit from the comments. Do you know of a good way to do this using the method you wrote about here?

        3. I use a top commenter widget to help increase engagement, do you know if there is a way to still use that plug in with this method? In other words can I track my top commenters regardless of what commenting system they are using (WordPress or Facebook?)

        4. Have you seen any increase in traffic to your site, or the number of people liking your Facebook page, as a result of using Facebook comments? (Also have you seen an increase in the number of comments?) Are lots of people who used to use the world press comment system, using the Facebook comment system? (are they switching) or are you getting new commenters who weren’t commenting before? (Or a mixture of both?) Do you find that people are comfortable sharing the comments they write on your blog on their Facebook wall?

        5. Finally when someone replies to someones comment are they noticed when the log into Facebook? or do they have to come back to the page?

        Sorry for so many questions, I just want to be sure this is the best way to do things before rolling it out on my blog. Thanks for your time!

        • http://collegeinfogeek.com Thomas Frank
          Author

          Sorry for replying to this so late!

          1. I’m pretty sure this doesn’t work. I compared some comments from my posts to the comments on the post link on Facebook – they aren’t synced.

          2. I haven’t tried out any of these plugins, so I can’t say much on this subject.

          3. I’m pretty sure this would still work. You might have to look at the plugin’s code and make it look for the custom comment count function in the tutorial instead of the default count function.

          4. To be honest, I haven’t seen many more comments and I don’t think my traffic increases are due to the Facebook comments. However, my audience is college students, and they just don’t seem to do much commenting at all.

          5. Yes, people are notified of replies. When they comment, they are automatically following the post. There’s a link to unfollow if they want, though.

  • Pingback: The Friday Wrap – Take action

  • http://www.xpressfilms.com Express FIlms

    Thanks for this tutorial … I’ve been trying to incorporate it on an existing theme using the standard method, just copying and pasting … but didn’t have much luck incorporating the comment count. Your tutorial is awesome …. Good job.

  • Nadeem Rasheed

    I am getting “Warning: http://invalid.invalid/?&gt; is unreachable.” I changed the app ID im confused what the problem is.

    • Nadeem Rasheed

      I figured out the problem i used the old code that was missing the “?”. After using the revised code it works with no problem

    • Nadeem Rasheed

      I figured out the error i used the old code that was missing the “?”. After using the revised code it works with no problem

  • http://sparkjam.net/ Paula

    As a non-designer, I found this tutorial easy to follow. I only hit a couple of snags but the developer provided good, timely assistance. The next step would be to use FB comments alongside Disqus. If anyone has successfully implemented the two after following this tutorial, I’d be interested to know how it went- if it is as easy as activating the plugin or if it requires changing the codes. Thanks, again, for this well-made tutorial!

    • http://collegeinfogeek.com Thomas Frank
      Author

      That would probably be pretty easy. This method hard-codes FB comments into the theme, and I don’t think Disqus is set up to hide/override anything other than WordPress comments.

  • http://www.vgutopia.com Andrew Nino

    I’m getting a single comment showing up on multiple articles. Not sure how to fix that bit haha

  • Justin

    A slight modification will allow you to use a filter, rather than replace every instance of comments_popup_link.

    function full_comment_count($wpCount) {
    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;
    $realCount = $count + $wpCount;
    if ($realCount == 0 || !isset($realCount)) {
    $realCount = 0;
    }
    return $realCount;
    }
    add_filter(‘get_comments_number’,'full_comment_count’);

  • Pingback: Comentários do Facebook no WordPress, Com Contador e Moderação | Blog Aprendiz - Dicas WordPress, Monetização, Design

  • Pingback: The Friday Wrap - Take action

  • Pingback: The Best WordPress Resources from Around the Web | WP Kube

  • Nathan

    Hey, great tutorial. Very helpful. I succeeded in implementing the Facebook comments on my WP blog. However I get an error under the comment box :

    Warning : URL not reachable

    Do you know what does that come from ?

    Thx

  • Pingback: Weekly Roundup #7: The Best WordPress Resources from Around the Web | WPbase

  • Steve

    I’m using the iThemes Builder framework and trying to get this to work for posts only, without including the regular WordPress comments option.

    If you take a look at this example, something is wrong as it’s throwing an error and pulling comments from some other post. I’ve confirmed I’m suing the correct FB Application ID.

    Any ideas?

    Example: http://scubashackct.com/travel/arrrr-dive-with-us-during-grand-caymans-pirate-week-in-november-2012/

    • http://collegeinfogeek.com Thomas Frank
      Author

      I’m seeing this on your comment form: http://grab.by/c3Cu

      That definitely shouldn’t be there. Without being able to see your code, I’m assuming you have a typo in your comments.php file. It should look exactly like this:

      <div class=”fb-comments” data-href=”<?php the_permalink() ?>” data-num-posts=”10″ data-width=”610″ style=”margin-bottom: 15px;”></div>

  • http://skotgat.com Rahul Banker

    I’ve managed to implement it successfully. However, when I try to moderate it, I find no comments in here : https://developers.facebook.com/tools/comments/?id=Your App ID Here

    I’ve also added myself as a moderator but still the comments gets published without getting moderated at all.

    Any help?

  • Bob

    On Step 3 I’m trying to find where in my theme the original comment count is. Would it be in functions.php? Or, could it be somewhere else?

    I realize you may have to put it in several places but where according to step 3 do I first place

  • Bob

    This part of your tutorial:

    If the comment count in your comments.php is diplayed as a sentence, instead of just a number, you can use the code below instead of the one line function call in order to allow for words like “no comments” and “one comment”. I’ve customized mine to be more inviting – I’d recommend that you do the same instead of being generic……

    is not working for me!

  • Pingback: The Ultimate Guide To Building A Personal Website | College Info Geek

  • http://howeoriginal.com Jonathan

    This has been extremely helpful. 99% done.

    I am having one last issue related to the code on my site and how it displays comment #’s.

    Here is the current code.

    ?php comments_popup_link(’0 ‘.__(‘Comments’,'edge’).”, ’1 ‘.__(‘Comment’,'edge’).”, ‘% ‘.__(‘Comments’,'edge’).”); ?>

    I can’t tell how to substitute your in without losing all the formatting for the display. Any ideas?

    • http://collegeinfogeek.com Thomas Frank
      Author

      Just put that code inside a <span> and then apply your styling to that :)

  • Jonathan

    Sorry goofed the code pasting.

    Here is my code correctly pasted:

    <?php comments_popup_link('0 ‘.__(‘Comments’,'edge’).”, ’1 ‘.__(‘Comment’,'edge’).”, ‘% ‘.__(‘Comments’,'edge’).”); ?>

  • Pingback: Tutorial recomendado: Insertar comentarios de Facebook en WordPress del modo correcto

  • Pingback: Vitamin E foods sources

  • Pingback: bron deko

  • http://lovebarrefaeli.com Maartje Weenink

    You’re tut is awesome!!
    I have just one little problem.
    I’m new to wordpress, so it would be really helpful if someone could explain to me how to sort the comments by the page they are posted on, instead of putting ALL the comments on ALL the pages.

    I saw some similar question and code some posts above, but it’s not working for me.
    I put it in the comments.php, is this right?

    Please help me put the comments on the right page!
    Thanks a lot!
    x Maartje

    • http://collegeinfogeek.com Thomas Frank
      Author

      That’s probably happening because you have your site URL in the Facebook comments call. You need to make sure it’s <?php the_permalink() ?> instead, like this:

      <div class=”fb-comments” data-href=”<?php the_permalink() ?>” data-num-posts=”2″ data-width=”470″ data-colorscheme=”light” data-mobile=”false”></div>

      • http://lovebarrefaeli.com Maartje Weenink

        I see :) Thank you so much for the quick reply!

        But I have over 400 pages I want comments on:P
        Do I need to make an individual code for every single one?
        And where do I post that new CSS, again in the comment section?

        • http://collegeinfogeek.com Thomas Frank
          Author

          the_permalink() is a piece of code that will get the current blog post. So whatever page you’re on, it’ll automatically use that URL. That’s why you need to use it instead of actually typing out the URL itself.

          What CSS are you talking about?

          • http://lovebarrefaeli.com Maartje

            Oh, now I see.
            I used the ‘normal’ code for the header and used your ‘page by page’ code in the comments.php.
            Thank you so much, your site thought me what I was looking for for so long! :)

  • http://worldtuningfans.com Ryan Hoole

    Oh my god, thank you, i have been trying to get the moderation part to work all night lol, great post!!!

  • Heather

    Hi, I’m keen to add a facebook comments box to my blog but as the blog is anonymous i don’t want my facebook account to be retrievable. is this possible without creating a new facebook page for my blog?
    Thanks for the useful info.

    • http://collegeinfogeek.com Thomas Frank
      Author

      I don’t think Facebook comments would be a good option for you if you’re trying to remain anonymous. You can’t reply to people’s comments under your Fan Page; you have to do it with your profile.

  • http://www.gta4mod.com Flavio

    How can I know which page did the comment came from? I just can see that some one commented at one of my pages, but I can’t see it’s URL so I’m not able to know what should I asnwer…

    • http://collegeinfogeek.com Thomas Frank
      Author

      If you switch over to Moderator View in your comments administration dashboard, you can hover over the “visit website” link and see the URL.

  • http://afroniquelyyou.com Sasha

    Hey, question. SO I currently use a comment system like Disqus and the Livefyre. I’ve noticed once I am using these systems, that following your tutorial the facebook plugin doesn’t show up. When I disable them it does and works with just the regular comments. What I want to know is is there a way to make this same tutorial work if I am using the Disqus/Livefyre comment systems? I really would love to have my readers be able to rapid fire comment with facebook comments on each post.

    • http://collegeinfogeek.com Thomas Frank
      Author

      I haven’t done this, but I’m pretty sure all you’d have to do is find the code in the Disqus/LiveFyre plugin that tells WordPress to ignore the call to comments.php and delete it. I’m not sure if this would break anything though.

  • http://www.tecnologianovedades.com/ Sebastian

    Hi. Your post is very useful, but i have a problem in the Step 4.

    When I click in Setings appears a new window but its stay frozen in “Loading…”.

    What can be wrong?

    Thanks.

    • http://collegeinfogeek.com Thomas Frank
      Author

      Probably just a Facebook problem – try again and it should work.

      • Cindy

        Thomas,

        Thank you very much for taking the time to put together your wonderful tutorial. I have FB comments up and working on my site. However I was not getting notified when someone left a comment.

        I also (like Sebastian) have gone to the link in your Step 4 (numerous times) and am getting a Loading box that never goes away. I will continue to try, however I have tried multiple times so far with no change.

        So I thought I would post and see if you have seen a solution to this issue since you and Sebastian discussed it in June?

        Looking forward to this one last piece of the puzzle being solved. :)

        Thank you,
        Cindy

  • http://www.tecnologianovedades.com/ Sebastian

    Solved.

    I add me as moderator trought my web’s facebook comments settings.

    Thanks so much!!

  • http://gennarodifiandra.com/ Gennaro

    Hi, thank’s for this guide. About step 4, I get notification only if the commenter is my friend on Facebook or the page is in my liked pages. I noticed that to have always notifications there is comment.create event: do you have a guide fot it?

    • http://collegeinfogeek.com Thomas Frank
      Author

      Hmm… I didn’t have that problem. Did you make yourself a moderator? If not, you probably won’t be notified of all comments.

  • Suzuki

    I don’t think Facebook comments would be a good option for you if you’re trying to remain anonymous. You can’t reply to people’s comments under your Fan Page; you have to do it with your profile.

  • devjyoti

    I implemented the facebook comment count feature. but i do get the following fatal error

    “Cannot access empty property”

    i think it is giving erro on line

    $count = $json->$url->comments;

    please help

    • http://collegeinfogeek.com/ Thomas Frank
      Author

      Recently it looks like trying to combine Facebook comment count with my own is really just screwing things up and making them slow. I’m not sure what the problem is, but I’ve removed that feature from my site for the time being.

  • http://www.inforock.net Inforock

    I have a problem with arras-theme. I’ve found that widgets.php shows the comments count in “featured stories” but I don´t know where I have to insert the code for the FB coments. Is anybody using it?

    Thanks in advance

  • http://www.decryptoblog.com Sumit Jha

    I have managed to implement it successfully in one of my client site but it’s not appearing on each and every page.

    • http://collegeinfogeek.com Thomas Frank
      Author

      Make sure your pages are set to display comments – you might even have to go into your theme’s code and make sure the comment call is even in the page.php file.

      Also, make sure you’ve placed the Facebook Comment code in the correct file (comments.php)

  • seanjacob

    The See More button doesn’t appear, anyone else have the same problem?

  • http://iflyalone.com Gary

    Hey there thanks for your guide!

    I’m going to try implementing this now on my website (http://iflyalone.com)

    Cross fingers.

  • Teh

    Hi,

    I am using the free theme Twenty Ten and I need some help:

    1. I am unable to find any code that says:
    or any code that says comment count
    in function.ph. Does any one knows and help?

    2. I tried to post a comment using FB but it seems like I am unable to delete the comment
    when I log in to my WP a/c – it also does not show up as comments…..
    I can only delete the comment by signing in on my FB and delate them…. does that means
    only vistor can delete their own comments? Admin cannot ?

    3. How can I get rid of the “Leave A Reply” form that is now sitting under the new
    comment by FB comment box?

    Thank-you.

  • http://www.sanggaardfotografi.dk Emil

    Hi,
    Nice guide.
    Well I created a facebook app and integrated it with the official Facebook wordpress plugin.
    The Facebook comments work just fine on my blog posts, but i don’t get any notifications how so ever.
    I added myself as an administrator, but I still don’t get any notifications.

    Why is that?

  • Pingback: This is reminder post « Swedish sire

  • http://www.maxfear.it/ max

    How can I use it in Italian??? i need to use it_IT instead of en_US in

    js.src = “//connect.facebook.net/en_US/all.js#xfbml=1&appId=****

    Thank you!!!!!!!!!!

  • titina

    is it in italian language?!

  • http://www.batik-lovers.com Toko Batik

    I followed the tutorial. But I never get notified when people commented. What’s wrong?

    • http://wp.envato.com/ Japh Thomson
      Staff

      Hey Toko, unfortunately we don’t have this feature at the moment. Don’t worry, we’re working on it :)

      • http://debradjwhite.com DJ White

        Hello, I really in trouble as I can’t even open my blog to remove what I entered. Here is a list of my messages. I have a backup from July 28th. Can you tell me how to fix or restore from the 28th?
        WARNING: THIS IS UGLY!!!
        // Get combined FB and WordPress comment count function full_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; $wpCount = get_comments_number(); $realCount = $count + $wpCount; if ($realCount == 0 || !isset($realCount)) { $realCount = 0; } return $realCount; }
        Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent (output started at /home/djjoy/public_html/wp-content/themes/zeestyle/functions.php:139) in /home/djjoy/public_html/wp-content/plugins/si-contact-form/si-contact-form.php on line 2189

        Warning: Cannot modify header information – headers already sent by (output started at /home/djjoy/public_html/wp-content/themes/zeestyle/functions.php:139) in /home/djjoy/public_html/wp-login.php on line 362

        Warning: Cannot modify header information – headers already sent by (output started at /home/djjoy/public_html/wp-content/themes/zeestyle/functions.php:139) in /home/djjoy/public_html/wp-login.php on line 374

        Warning: Cannot modify header information – headers already sent by (output started at /home/djjoy/public_html/wp-content/themes/zeestyle/functions.php:139) in /home/djjoy/public_html/wp-includes/pluggable.php on line 680

        Warning: Cannot modify header information – headers already sent by (output started at /home/djjoy/public_html/wp-content/themes/zeestyle/functions.php:139) in /home/djjoy/public_html/wp-includes/pluggable.php on line 681

        Warning: Cannot modify header information – headers already sent by (output started at /home/djjoy/public_html/wp-content/themes/zeestyle/functions.php:139) in /home/djjoy/public_html/wp-includes/pluggable.php on line 682

        Warning: Cannot modify header information – headers already sent by (output started at /home/djjoy/public_html/wp-content/themes/zeestyle/functions.php:139) in /home/djjoy/public_html/wp-includes/pluggable.php on line 881
        THANKS IN ADVANCE!
        JOY, DJ

        • http://collegeinfogeek.com Thomas Frank
          Author

          You’d just need to access you functions.php file via FTP and fix it. Once it’s fixed and no longer generating a PHP error, you’ll have access to your blog again.

  • Ari

    Love this tutorial, thank you!

    I am having trouble with one step: In Step #4, when I click on the “settings” link nothing happens. I just get a “Loading” window that never actually loads. This has been happening for about 3 days and is the only part of the Facebook comments integration that is not working.

    Any ideas how to fix this?

  • http://www.psychiclotto.org Craig

    I wish I would have seen this a few months ago. I already have the facebook comment box and don’t have any options to log in as administrator or do administrator things. I would like the option of commenting as the site administrator rather than with my own facebook account, is there a way to do that?

  • Brody

    Hello :)

    I added myself as a moderator to the comment moderation tool in settings, but I’m still not getting a notification that a comment was made… any ideas?

  • http://wachiturro.net Wachiturro

    Hi, you know where i can see a demo of how it look? *sorry for my bad english :P

  • Emily

    Do you have it implemented somewhere so we can see what it looks like?

  • Riccardo

    THANK YOU VERY MUCH!
    This is the only place where I’ve found how to receive FB Notifications!!!

  • Paul

    Use Case:

    1.) Go to post
    2.) Add FB comment
    3.) Post shows 1 comment on the post itself
    4.) Visit homepage where the post is featured as a result of being new and comments equal 1
    5.) Go back to post
    6.) Post now shows that there are two comments on the post
    7.) Homepage still shows 1 comment for that particular post

    From WP Admin Dashboard I see the comment just posted while at the same time there are no other comments in the system:

    Pending (0) |
    Approved |
    Spam (0) |
    Trash (0)

    When I look at the comments table in the database I do not see any other comments. Here is an export from the database:

    Column Type Null Default
    comment_ID bigint(20) No
    comment_post_ID bigint(20) No 0
    comment_author tinytext No
    comment_author_email varchar(100) No
    comment_author_url varchar(200) No
    comment_author_IP varchar(100) No
    comment_date datetime No 0000-00-00 00:00:00
    comment_date_gmt datetime No 0000-00-00 00:00:00
    comment_content text No
    comment_karma int(11) No 0
    comment_approved varchar(20) No 1
    comment_agent varchar(255) No
    comment_type varchar(20) No
    comment_parent bigint(20) No 0
    user_id bigint(20) No 0

    Any ideas?

    • Paul

      What I have also noticed is that when I comment again, the count goes up to 4.

  • http://www.mothersnotebook.com Asma

    Hi,

    I have followed all your steps in the tutorial, the facebook comment box is up, however it is not getting the feed of comments from my FB page (????). It is however getting comment feeds from when users have shared the link on their timeline.

    Please can you help???

  • Pingback: WordPress: Adună numărul comentariilor de pe blog cu numărul comentariilor de pe Facebook | Florea Cristian

  • http://shiningallspark.web.id shining

    thank for the comprehensive tutz, I really need the feature of moderation and I can easily understand what you explain. Though actually I have read the documentation of facebook comment in fb developer.

    Thank anyway

  • http://www.backpackingdiplomacy.com Andy

    Thanks for the post Thomas! I really appreciate the code suggestions for adding adjusting my comments. Do you by chance know how to make the Facebook Comments Importer take comments from all old posts and not just the most recent 10?

  • Pingback: my favorite guest posts...ever - Dear Blogger | Dear Blogger

  • http://androidvoip.org/ Katy Lawrence

    My intention was to replace regular wordpress comment with Facebook comments, this tutorial is nice but the it ain’t providing what I came to seek. Keeping both the comments can also be done through WordPress plugin but the tricky part is replacing one with other.

    • http://collegeinfogeek.com/ Thomas Frank
      Author

      Actually replacing the default comment system is really easy as well. Literally all you do is delete the rest of comments.php and replace it with that facebook comment call. I’m pretty sure the plugin can replace the comments for you as well.

  • Dennis

    Is it possible to have different sets of comments on different pages?

    Create multiple apps for the same website?

    For example, on page 1, I want to ask a specific question and have people answer in FB comments on that page.

    The, on page 2, I want to ask a different question and have people answer that one in FB comments on that page.

    Don’t want to mix all of the answers together in one comment stream.

    Thanks!

    • http://collegeinfogeek.com/ Thomas Frank
      Author

      I believe this is possible, though I’ve never done it. You’ll obviously need multiple Facebook apps to do this.

      What you’d want to do is create a custom post type for the each kind of post you want a different response for. Then you’d need to use the get_post_type() conditional tag to determine which Facebook app ID to use for that page’s comment system.

      Do note that this will require some knowledge of PHP.

  • http://www.backpackingdiplomacy.com Andy

    Thanks a lot for the detailed comment, it is very helpful. Quick question, do I have to become verified by Facebook in order to use an app? Also, is there a way around using a cell phone or credit card?

    • http://collegeinfogeek.com/ Thomas Frank
      Author

      Yes, you do have to become verified these days. I don’t think there’s a way around those methods.

  • enetblog

    hi, i want to get posts sort by facebook comments

  • http://www.facebook.com/steven.mckeever Steven Mckeever

    Does this method allow the facebook user to be notified (via facebook) if further comments are added to wordpress post?

    • http://collegeinfogeek.com/ Thomas Frank
      Author

      Yes – I have conversations with commenters all the time, so it seems to be working great! :)

  • Nacho Daddy

    I would like a large glass of ale.

    • http://collegeinfogeek.com/ Thomas Frank
      Author

      I’m more of a lager guy.

  • http://www.facebook.com/yun.sungjin Sungjin Yun

    when i post a link to a blog post on facebook, how can those comments appear on the blog post as well?

    Currently, if they post on the blog post with their facebook login, it’ll just appear on facebook as “sjy has commented on this link”

    • http://collegeinfogeek.com/ Thomas Frank
      Author

      I’m a bit confused – do you mean to say that you want comments on the link (on Facebook itself) to show up on the blog post comments?

      That’s actually only something you can do with LiveFyre. No other commenting solution pulls in comments straight from social networks.

  • http://www.facebook.com/hermanjr2011 Herman Trivilegio Jr

    it works like a charm

  • Preeti sBlog

    Hi, we were trying to implement step 3 of the post that is to combine the count of comments from facebook and wordpress. We could reach at a very simple solution which needs just adding a function to functions.php file and no other changes are required to be done. Pls have a look at the our post for the same at http://preetisblog.com/programming/display-combined-comments-count-of-facebook-and-wordpress-comments-on-blog/ and give us a feedback about how u feel about the same…
    Regards
    Admin
    http://www.preetisblog.com

  • Pingback: TWTW: New Resources and Tools, Wordpress Section, Web Dev and Inbound Marketing Updates - Bibiano Wenceslao - Bibiano Wenceslao

  • Maria

    How would you go about doing this in a child theme? I have always wondered how to add code right after the opening body tag in the header.php file that is in the child theme. Are there any WPtuts tutorials on something like this?

  • http://www.ijoobi.com/ Lalene Cababat

    thanks for the post!

    • http://www.ijoobi.com/ Lalene Cababat

      testing

  • http://www.facebook.com/people/Joshua-גדליה-חיים-Reback/8829667 Joshua גדליה חיים Reback

    Thanks for the tut. I’m trying to figure if there’s a way to get Facebook comments from whenever my articles are shared to appear along with the article’s comments on the post page. I’ve seen Facebook comments that are on the article itself appear separately on Facebook as shares, but never the comments on shares back in the article.

    • http://www.facebook.com/ericspaceship Eric Peterson

      I would like to know this as well!

    • http://collegeinfogeek.com/ Thomas Frank
      Author

      Hi Joshua,

      That’s actually something you can only accomplish with the LiveFyre commenting system (as far as I’m aware). Facebook’s commenting system doesn’t support it.

  • http://www.facebook.com/tuan532 Tuan Anh Nguyen

    thanks

  • Amaykul

    is there any way to disable the comments on Pages? I mean the comments should show up only on posts not on pages. Thanks

    • Brian Quan

      Did you end up finding out how to solve this? I am after the same thing. I just want the Facebook comments on my posts, not pages.

    • http://collegeinfogeek.com/ Thomas Frank
      Author

      Yes, this is actually really easy. Just go into your theme files, find page.php, and remove the call to comments_template. This will rip the comments section out of all your pages altogether.

      Or, if you just want to remove Facebook comments – but still leave regular comments – on your pages, you can do this:

      if ( is_single() ) { code for facebook comments }

      That way it won’t show up on pages. Be sure to use is_single(), not is_singular() – the latter looks for pages as well as posts.

  • disqus_7ZoeaOIkIG

    Has there ever been a means to simply add a check-box per social media site to publish a comment on a WordPress blog to the selected (checked) SM portals?

  • Jared

    What about the Events Template on WordPress where you need to add Facebook commenting to every new event posted. As seen on my site http://www.toodol.com. Can anyone help me with adding Facebook commenting automatically when a user creates an event. Thanks!

    • http://collegeinfogeek.com/ Thomas Frank
      Author

      You’d probably need to take a look at the custom template file that is used to generate the new event page. You can probably include a call to your comments file in that.

  • http://twitter.com/olagon Olin Lagon

    Facebook counts only include top level comments, not replies. We had to write a custom routine to tally up comments + replies.

    • http://collegeinfogeek.com/ Thomas Frank
      Author

      That’s true – it’s one of the limitations of the system.

      Honestly, the full comment count function has sort of stopped being useful. I’m guessing it’s a recent problem with the Facebook API, as it worked when I wrote this.

  • http://www.facebook.com/jessedepril Jesse De Pril

    Thanks for the tutorial! However, the function full_comment_count() is insanely slow when you use it multiple times.

    • http://collegeinfogeek.com/ Thomas Frank
      Author

      Yes – this is sort of a recent problem.

      When I wrote this tutorial, my full comment count function worked perfectly fine. However, it started slowing things down and generating errors a couple months ago. I don’t have it running on my site right now.

      I’ll try to get the post updated soon to reflect this.

  • slimderek

    Hi
    How can i implement it on a genesis theme

    • http://collegeinfogeek.com/ Thomas Frank
      Author

      I’m not a Genesis user, so I can’t say for sure,

      However, if Genesis has a PHP file for comments, that where you would implement this.

  • samar

    hi !! that’s what i’m looking for ! i have a question is these steps are avaible just for wordpress ?? because i’m with french plateform Overblog !

    thanks

    • http://collegeinfogeek.com/ Thomas Frank
      Author

      This tutorial is written with WordPress in mind, but a similar outcome should be possible on your platform as long as you have control over the blog’s functions. If Overblog has a function to get the link of the blogpost, you can use that in place of the_permalink when telling the Facebook comment system what the current URL is.

  • http://www.facebook.com/veltmanis Miks Veltmanis

    Huh??? I left a question yesterday about why did comment count did not work and my post got deleted ???
    graph.facebook… does not have any record of a comment left, therefore doesnt count. how can that be fixed?

    • http://collegeinfogeek.com/ Thomas Frank
      Author

      Miks – It seems right now there is no reliable combined comment count solution – Facebook’s API seems to have changed. Hopefully there will be something in the future that makes it a viable option again.

  • Guest

    testds

  • Théo Lévêque

    I have a problem with this plugin, the website of my company has got one but it was installed by an IT company and they have two of their employees as fb:admin and my boss want them out, can I do it myself (I unfortunately have no access to the page’s code) or do I have to ask them?

  • http://twitter.com/xhibits_design souleye

    thank you for this enlightening tutorial. everything is clear to me except, when you say ‘There will likely be several places within your theme that you’ll need to insert this code’ do you mean in all of those places or ‘any of those places’? thank you.

    • http://collegeinfogeek.com/ Thomas Frank
      Author

      Right now it seems the comment count function is broken because of Facbook, so you should ignore that part. However, if it were working, you’d basically go through your theme and replace every instance of the comment count function with the new function.

  • Pingback: How To Learn More Outside Of Class Than You Ever Could Inside It | College Info Geek

  • http://nyctalking.com/ Angel Rodriguez

    Should this still work? Doesn’t seem to work on my site, but I wonder if digg digg has something to do with that! Hmmm.. It gave me trouble with FB embedding in the past… Thanks for the tutorial!

  • http://www.facebook.com/mittul.chauhan Mittul Chauhan

    thanks a lot

  • http://www.facebook.com/yagur.yagur Yagur Yagur

    hi

  • http://www.experiencesardinia.com/ Susanna Lobina

    great tutorial, receiving notifications of comments made on my website. What is not happening is when I reply to a comment a notification is not being sent to the original commentator. Is this how it is supposed to work? if not what is missing? If the people that time the time to post a comment on my website and when I reply they are notified there is almost no point in replying, right cause they’ll will never know, please help thank you

    • http://collegeinfogeek.com/ Thomas Frank
      Author

      It seems Facebook Comments is a little buggy in this aspect. I’ll often reply and get replies back from the original commenter, but sometimes I won’t. And often I won’t even get notified of comments (sometimes it works, other times not) – so I make it a practice of checking my comment queue every day.

  • pramodpandey

    After following this step i integrated facebook comment on my blog, but problem is if someone comment on my blog i don’t get notification for comment.Can anybody tell why is it happening so?

  • http://www.thenerdynurse.com/ The Nerdy Nurse

    I’m using a child theme of genesis and the only place with the comments.php file is the actual “genesis” theme files. It gives me a warning message not to touch those and only alter the child theme files.
    So I’m apprehensive to mess with them.
    Also, I wasn’t sure where to put the comments in relationship to the comment.php file.

    Your thoughts?

  • walter

    Facebook evolves from the moment it starts. Until now, the makers of Facebook still upgrade their perspectives in order to give the best for the users. And as of December 15, 2011, a Timeline is the new virtual space in which all the content of Facebook users will be organized and shown. In Timeline, there is the so called Facebook Cover Photo in every Facebook Profile. Replacing the Facebook Profile, in a Timeline the photos, videos and posts of any given user will be categorized according to the period of time in which they were uploaded or created.

  • http://www.facebook.com/sophia.coelho.9 Sophia Coelho

    Hi, are you guys still receiving the notifications after the last timeline change? I had it implemented in two sites and it was working beautifuly ’til a few weeks ago. Now if I access the control page via https://developers.facebook.com/tools/comments/ I see the comments, but there’s no notifications as before. Does anyone know why this is happening, if we need no change something or anything at all?
    Thank you.

    • Samuel Manley

      Any luck with this I cant see notifications either..

  • ph community

    Thanks for nice tutorial. Its great to be implemented in our website http://www.peoplehope.com. How about the Disqus comment plugin like this post… How to implement it? any great tutorial about this??

  • http://www.facebook.com/vimmy.negi Vimmy Negi

    nice

  • http://www.facebook.com/lelper Lela Perez

    Thank you SO much for making this! I used these directions to put facebook comments on my webs.com site. I had tried to use an outdated version of some directions on how to do it, but couldn’t figure out how to use the developer mode and actually link it to my app. Thanks again!