How To Add Facebook Comments To Your Blog

How to add Facebook Comments to your BlogAs you have probably noticed, more and more blogs, e-commerce websites and all kinds of applications online are taking Facebook integration more seriously. One of those popular elements is Facebook Comments.

But what you probably don’t know is that it’s not that complicated to add them to your blog yourself. In fact, I’m pretty sure you can be rocking Facebook Comments on your blog in the next hour or so. I’ll tell you how to do it in just 5 steps.

Before we start this mini-tutorial, let’s go over a couple of things…

What are the Pros?

There are a few reasons you might be considering the possibility of integrating Facebook Comments into your blog posts.

Exposure

  • Comments are easily published on the commenter Facebook Wall Timeline. This helps increase awareness, you are now in front of that user’s network of friends
  • The comment is posted on the user’s Timeline along with a thumbnail, headline and excerpt from the blog post as if the user was sharing your post

Engagement

  • Replies to those comments can take place either on the same post in your blog or on that user’s Facebook Timeline. This motivates conversation not only inside your blog but also on Facebook
  • Those comments can also be Liked by other users

Authentication

  • Most people are on Facebook and are already signed up to their account, which means they don’t need to authenticate to any commenting system. Users that are not logged to Facebook can log in from your post comments
  • Most people are familiar and trust Facebook

And the Cons?

The issue for me is not that this is a 3rd-party solution living in your blog. If you think about it, most of us bloggers already use 3rd-party apps to support our comments. I use Disqus in this blog but you’ve seen others like Livefyre or IntenseDebate. Very few blogs still rely on the WordPress native comment system.

But in this case you need to consider that your comment system belongs and it is a vital element of a social network.

  • Not everybody is in love with Facebook, some people actually prefer Google+, some are hardcore Twitter users. The invitation to interact via a network that is not their preference might not be welcomed with open arms
  • Totally depending on Facebook might not be such a good idea, you know how they change things around from time to time. What if tomorrow they dramatically change one of those elements you have deeply integrated into your blog? #goodtimes

That’s why some blogs offer the the possibility to comment through Facebook while they still have a more universal commenting system.

So there you have it, advantages and disadvantages I see and share with you to help you make a better decision.

Are you ready to get started? Let’s do this thing then!

1. Become a Facebook Verified Developer

Becoming a Facebook Verified Developer is very easy, don’t let the fancy terminology scare you. Let me take you step-by-step:

Facebook Developers Website

  • Go to the Facebook Developer website
  • click on “Apps” on the top blue navigation
  • Click on “Create an App” (this will be as far as you can go without being a developer)
  • You will see a “Your account must be verified to perform that action” message and you will be offered two methods: Phone or Credit Card
  • If you go with the phone option, you will provide your number, Facebook will send you a code via text and you will submit that code back to them. Boom! You’re in business
  • If you choose Credit Card just provide your information and follow the instructions. Sometimes this is the best option, specially if you’re outside the US

That’s it, you wanted more? Call your spouse and share the news: You are a Facebook Verified Developer

Cool, now we can move on to more important things…

2. Create a Facebook App

Since you are now a verified developer, you can continue to create a Facebook App. The first thing you’ll see is a little popup so you can indicate the name of your app.

Create a Facebook App

App Display Name is simply the name that is displayed for others to see and the App Namespace is used for Open Graph and Canvas Pages. Do NOT sweat this stuff because we are not really building an actual App and we don’t need to display anything to anybody. Just come up with a name that represents what we’re doing so you can quickly identify it in the future.

Good example: “your website comments”.

And we need to make sure these names are valid and available, as you can see in green text on the previous image. If they’re not, just come up with something different.

Your App ID

This will give you the most important piece of information you will need: your App ID and your App Secret. Save them for your records.

Your App ID

Configure your App

Now we just need to do a little configuration for your App. On the same page, scroll down to the “Basic Info” section. Since we already have a Display Name and a Namespace, all we need to add here is the contact email and the App Domain, which is your blog’s domain (yourdomain.com) without the “http://”.

Facebook App Configuration

Scroll down a little more to the section “Select how your app integrates with Facebook”. Select “Website” and add your blog’s URL, this time including the “http://” so it looks like this: “http://www.yourdomain.com”.

Your blog's integration to Facebook

Save Changes. And we’re done configuring the Facebook App. Congrats!

3. Get Your Code

Now we’re going to a different section on the Developer’s site. Click here so you can get your comments code. If you’ve added the Like button or the Like Box on your blog, you’ll probably be familiar with how this tool looks. If you’ve never seen this, don’t worry, this is very easy.

First thing is to configure how the comment box is going to look on your blog:

  • Start by adding your blog’s URL again (http://www.yourdomain.com)
  • Specify the number of comments you want to display on your blog post
  • Set the width of the box depending on how wide the content area is on your blog
  • The “Color Scheme” will usually stay as “Light” unless you have a dark background on your site and prefer to go that way

The section on the right of the screen (see image below) gives you a preview of how things are going to look once you install on your site. As soon as you’re happy with it, click on “Get Code”.

Facebook Comments Tool

And a new box will pop up, this one is to grab your code but before you do:

  • You get 2 options for code: HTML5 and XFBML. My preference is HTML5
  • And very important, Select the correct App from the dropdown menu, specially if you have more than one

Facebook Comments Code

Now you’re ready to copy the code from the first box, there is no need to change anything since Facebook already integrated the App ID in the code for you. Your code should look a little something like this:

<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]“;
fjs.parentNode.insertBefore(js, fjs);
}(document, ‘script’, ‘facebook-jssdk’));</script>

4. Adding the Code to your Site

Two more steps and we’re golden.

Now we are going to have to paste this code into your PHP code, inside your “header.php” file to be more exact. I know it sounds like we’re stepping into another dimension but it’s actually pretty easy. Stay with me…

There are two ways you can do this, if you’re comfortable connecting and managing files on your server via a FTP Client you can do that. Connect to your server and locate the “header.php” file.  

The second option is from your WordPress Dashboard. This sounds more human, right? Most themes have a section called “Editor” under the “Appearance” tab on the left menu. Again, that’s WordPress Dashboard > Left Menu > Appearance > Editor.

Wordpress Editor

On the right side of your screen you’ll see a list of all the theme files, find and click on “Header (header.php)”, that will display the actual code in the file in the center of your screen.

Now, paste your piece of code right after the <body> tag as shown in the following image.

Insert Facebook code into your theme

Save when you’re done.

5. Adding the Facebook Code to Your Comments

Let’s go back to Step 3 to grab the other code from Facebook which should look like this:

<div data-href=”http://yourdomain.com” data-num-posts=”10″ data-width=”550″></div>

In this case we do need one minor tweak. What happens with this code is that Facebook is providing it ready to work for that specific domain but, what we want to do is install the comments on every post in our blog. So we’ll replace the section that contains your domain (http://yourdomain.com) for this: <?php the_permalink() ?> and now you’re code will look like this:

<div data-href=”<?php the_permalink() ?>” data-num-posts=”10″ data-width=”550″></div>

That will do the trick. Now your Facebook Comments will automatically appear on every blog post you publish.

We need to go back to our WordPress Editor now. Locate the file named “comments.php” from the menu on the right.

Add Facebook Comments code into your blog posts

In this case the positioning of our code really depends on where we want the comment box to go, I wanted them on top of the WordPress native comment system so that’s where I placed it (above image).

Don’t forget to save.

And with that, we are done. No high fives yet…

Results

It’s the moment of truth, we need to go to our site and see if the Facebook Comment Box is showing up in our posts. And this is what you should see:

Facebook Comments in your blog posts

Let’s Test It!

Let’s test the comment system just to make sure everything is working properly. First just add a comment right there in your blog post and make sure you checkmark the “Post to Facebook” option right below the comment box.

Testing your Facebook Comments

Now check if the comment is displayed on your Facebook Timeline.

Facebook Comments on your Wall

As you can see, besides the comment, the post image, headline, and the meta description for the post are also displayed on the Facebook Timeline. Very similar to a share. Shiny!

Reply from the Timeline

Now try interacting with that same comment right from the Timeline to see if it also gets displayed on the blog post page. In this example, I’m replying with my wife’s account, check it out.

Reply from the Facebook Timeline

And back to your blog post, things should be looking like this.

Facebook reply on your blog post

And now you have a conversation about your post that is happening in two different places. Isn’t the Internet beautiful? I think so too…

Authentication

Remember, if the user is not currently logged into his/her Facebook account, they will be presented with the option to sign in right from your blog post. So let’s sign out of Facebook and go back to your post to see if this works.

Facebook authentication from your blog post

Now you’re rocking Facebook Comments on your blog posts.

Questions?

Do you have any questions? Let’s do this, use the comments section to ask any questions but also, please provide feedback. Share with me if you were successful or if you did it in a different way, anything that might also help other folks.

Happy Facebooking!

Related Posts Plugin for WordPress, Blogger...

About Francisco Rosales
I'm the author of SocialMouths. I also help entrepreneurs and small businesses turn their vanilla "web presence" into a profit powerhouse using techniques on social media, content and email marketing to generate traffic and convert to leads and sales. Caffeine addict and a hopeless fan of Dr. Sheldon Cooper. Bazinga! Learn more

Follow me on Twitter ·

  • http://www.adamzuercher.com Adam Zuercher

    This is a great post and I appreciate the details on how to set this up. Right now I’m using the WordPress native comments on our business blog. I’ve been thinking about using Disqus or Facebook for comments. I’m leaning towards Disqus for the sames reasons/cons of using Facebook. Since you are using Disqus, should I assume that’s what you recommend? Is it possible to use both? 

  • http://www.socialmouths.com/ Francisco Rosales

    Adam, I have been using Disqus for about 3 years although I’ve been considering Livefyre lately. I’d recommend either one.

    You can also combine the 2 systems with this same process.

  • http://mysocialgameplan.com Jonathan

    Thanks for sharing this great guide.  Obviously you put a lot of work into it!  I still prefer the universal commenting systems to Facebook, as I know tons of people are opposed to moving their Facebook activity outside of Facebook.  And I think with the continuing privacy concerns people have (whether justifiable or hysteria) with Facebook, I think the trend will be toward people trying to keep their online social interactions…as minimally social as they can.  Odd, I know.  But they are the consumer and we must go along with it :)

  • http://www.adamzuercher.com Adam Zuercher

    Thanks for your thoughts, Francisco. Curious…what does Livefyre offer that Disqus doesn’t that makes you think about switching?

  • http://www.socialmouths.com/ Francisco Rosales

    Mostly “Live Conversations”.

    @dino_dogan:twitter has a great post comparing the 2 systems here: http://diyblogger.net/what-comment-system-should-i-use-for-wordpress and some thoughts on Facebook comments as well.

  • Mary Lou Kayser

    Fantastic tutorial! I just followed your step by step instructions and everything worked beautifully. Thank you for solving this problem… I have noticed that people in general don’t want to leave Facebook, but if you have a blog post and are asking for interaction, what do you do? This is the answer! :)

  • http://couchable.co Tyler Herman

    For those of us who don’t have or want a Facebook account I would strongly recommend not using Facebook for your comments.

  • http://www.socialmouths.com/ Francisco Rosales

    Hey Mary, you’re quick! I’m glad it worked out and, thanks for coming back and letting me know.

  • http://twitter.com/MorganBarnhart Morgan Barnhart

    Great post!!! I have been on the fence about adding Facebook comments for all the con reasons you gave. I want to add it as an extra comment option and not the only because a lot of times, I’ll want to comment on someone’s blog, but when I see that they only have Facebook comments enabled – I leave. 

    So Facebook comments definitely have some pros, but I always suggest having two different ways to leave a comment to give people the option. 

  • http://www.socialmouths.com/ Francisco Rosales

    I agree 100% with you Morgan, in my opinion you should not have only Facebook Comments. Actually, this post is to add it to your existing setup, not to replace the commenting system you already have on your blog.

    Thanks for stopping by =)

  • http://www.sparringmind.com Gregory Ciotti

    “Very few blogs still rely on the WordPress native comment system.”

    On social media sites, this is true, but I doubt this is accurate in an overall sense.

    I have to be the ‘critical’ guy on this post, but I’d love to hear what you all think of this…

    The thing is, I would NEVER trust my comments to a 3rd party system.

    Why?

    If that 3rd party goes belly up, makes some godawful changes, or whatever else, I’M STUCK USING THEM OR I’M GOING TO LOSE MY COMMENTS.

    I don’t like relenting that kind of control over my blog, which I self-host for that very reason: to have complete control over it.

    I don’t want Facebook owning my comments, and if people start migrating to the next big thing, I don’t want to lose all of that discussion due to changing over to some other sort of commenting system.

    Call me crazy, but that’s my 2 cents.

  • wites

    There is already a WP plugin that do all these. The name is SEO Facebook Comments http://wordpress.org/extend/plugins/seo-facebook-comments/. I’ve already installed and tried it in one of my blogs.

  • http://www.socialmouths.com/ Francisco Rosales

    Hey Gregory, I totally see where you’re coming from. I believe in putting the focus on properties you own and have full control. I for example don’t believe in platforms like Tumblr or don’t understand bloggers that say that Google+ is the new blogging.

    The reason I use a 3rd-party for my comments is because I do believe they offer something of value, the conversation can’t only live inside your blog. I also like the real-time sense of connectivity Livefyre provides. The native system on the other hand is weak in those aspects.

    But I think I agree with you on the concept, as a matter of fact today we have Facebook about to dramatically change the way we interact with our communities on Pages and you don’t have a say. Perhaps the lesson here is exactly what you’re saying, don’t rely too much on things you don’t control.

    Your 2 cents are welcomed and appreciated.

  • Avelmar Manansala

    I made it!!  I am now using FB Comments along with WP’s very own.  Thanks so much.

  • Abigail K

    Thanks for this! Love it when a tutorial does what it says on the box! 

  • http://www.socialmouths.com/ Francisco Rosales

    Thanks for sharing Wites. The reason I didn’t cover anything regarding plugins is because I believe in having the least amount possible, obviously if there is a way of integrating things in your code rather than a plugin with a fairly simple configuration.

  • http://www.socialmouths.com/ Francisco Rosales

    Cool, thanks for letting me know!

  • Anonymous

    As always, thanks for the great information and step by step guide. I too have been on the fence about adding this option. I have Disqus and like you would keep that and just give people another option as to how to comment. I tend to be reluctant to use the FB system when commenting on other people’s sites. I guess I’d rather have them know where to find my site if they are interested. With the FB option you only comment as yourself. Some people may like that. I would love the additional exposure to my fan page.

  • http://girlseeksplace.wordpress.com/ Brianna

    Thanks, Wites. I will check that out.

  • http://girlseeksplace.wordpress.com/ Brianna

    Thanks for sharing this, Francisco.

  • http://tweet4ok.com/ Frithjof

    I agree with both sides… I would not want to force people to log into Facebook to comment but I would love the Facebook comments to show up on my blog….
    Wouldn’t it be nice to have both?
    Can’t we just all get along? :-)

  • http://www.carrotmedia.com/ Facebook App Developer

    Firstly, thanks alot for posting this guide as I was looking for the same topic all over the internet. The problem with the comment section in my blog is whenever someone comments, the same comment keeps on showing up in each and every post. What could be the reason behind it? Any ideas ?

  • Lukasmuller75

    Hi, I found your description really helpful, but have still a problem. I don’t want to show my comments of my useraccount of Facebook, but of the comments of my page from my company. Is this possible? How can I do this? 

  • Lukasmuller75

    Sorry, I meant of my page from my company in facebook of course.. Just to avoid misunderstandings :)

  • Mullenann4

    Francisco, this is the first I have realized that when people use Disqus or any other comment type, they are not using what you called WP native comments. I use WP native comments because I didn’t see any reason for doing otherwise. Why aren’t bloggers other than social media bloggers using WP?

  • http://www.socialmouths.com/ Francisco Rosales

    It’s a great question but To be honest, I’m not sure if this possible. Have you seen that Facebook has the option to comment on Facebook as your Page rather than your personal profile? I’m not sure is this also applies outside of its domain but I would try that.

    Of course you need to a Page admin.

  • http://www.socialmouths.com/ Francisco Rosales

    Never heard of something like that but I’d start with checking the comments php code. Sorry I canny of much help with your issue.

  • http://www.socialmouths.com/ Francisco Rosales

    I think it’s a matter of giving people options, I don’t suggest you replace one for the other.

    I also understand this is not for every blog. As you can see, I chose not to have them on this blog but in some cases I have suggested it for clients.

    Thanks for your comment =)

  • http://www.socialmouths.com/ Francisco Rosales

    I agree, even though my personal profile is totally public, I have no interest on exposing it, I’d rather comment as my Page.

  • http://www.finallyfast.com/ Ascentive

     Hi  Francisco,

    Thanks for sharing this tutorial. I’ looking forward to give it a try this weekend.

    ~Anja~

  • http://www.carrotmedia.com/ Facebook App Developers

    I asked the similar question to one of my close friends who is very skilled in PHP development and he fixed it. You were absolutely right. It was a code problem. Thank you :)

  • malonso21

    francisco,,, thanks for sharing. I personally think that this is what I call the “second level” use of open graph trhu the social plugins (first would be like box and buttons, third would be login/connect).
    I have had suggest some of my clients to actually use this but for some of them, it may be quiet risky because of the lack of control of the post. YOU CAN’T delete any comment unless you desinstall the plugin.. and even if you do so, the post will be still “live” Whitin the user’s connections…….I’m not saying that you have to delete any negative comment (they always help you becomen better and improve your product/services).. What I say is that, for me, this is way more subject to be analized to be used…
    I think for blogs it is an excelent option (a must?)
    BTW.. when you say “on the users timeline” regarding one of the main Pros, For me it would be better to add

  • malonso21

    francisco,,, thanks for sharing. I personally think that this is what I call the “second level” use of open graph trhu the social plugins (first would be like box and buttons, third would be login/connect).
    I have had suggest some of my clients to actually use this but for some of them, it may be quiet risky because of the lack of control of the post. YOU CAN’T delete any comment unless you desinstall the plugin.. and even if you do so, the post will be still “live” Whitin the user’s connections…….I’m not saying that you have to delete any negative comment (they always help you becomen better and improve your product/services).. What I say is that, for me, this is way more subject to be analized to be used…
    I think for blogs it is an excelent option (a must?)
    BTW.. when you say “on the users timeline” regarding one of the main Pros, For me it would be better to add
    “it is delivered to the newsfeed of the user’s friends”

  • http://megmccormick.com/ Social Media Meg

    Thanks for the tutorial, I’ve tried adding FB Comments to my blog via WP Plugins and through FB Apps with mixed results and glitchy things happening to the comments.  I’m going to give this a try. 

  • Greenbutt

    Yeah… this doesn’t work

  • Juan Fermin

    I’m guessing you like Disqus better, since you didn’t switch over yourself? 

  • http://www.facebook.com/profile.php?id=1301243907 Jennifer Floyd McClure

    Really great article. Thanks very much!

  • rheezID

    How do I know when someone facebook-comments on my site?

  • Dsfadf

    Leurs Sac Longchamp
    sont admirables au milieu du lot a de très convoité par les célébrités et
    fashionistas. However, when going to quite a few conventional timesfor instance
    the siLongchamper screen premieres, Lactualité précise pourquoi ces
    accoutrements accepter devenu tellement acceptée parce que le montant absolu
    que vous payez pour ces Sacs Longchamp Pas
    Cher
    Vintage à main gris argenté 47672 est le compte elle. Fresh air
    Kennedy séries Footwear Boucle de quatre models, allant duluxe à are generally
    qualité des hommestraditionnel exterior lisse des matériaux, facilement
    disponible, et sont accompagnés par le talon féminin. Pour dautres, les corps
    acceptée aussi bien accepterla connaissance dadorer lapparence et le luxe.

  • Joycelyn Brownlee

    Share with me if you were successful or if you did it in a different way, anything that might also help other folks.

    http://vinoenology.com/
     

  • ankya7

    That is so well explained sir. Thanks for taking time to write step by step tutorial.  

  • http://www.everything-microsoft.com/ windows 8

    As you have probably noticed, more and more blogs, e-commerce websites
    and all kinds of applications online are taking Facebook integration
    more seriously. One of those popular elements is Facebook Comments.

  • http://www.kingstonflowers.net/ kingston flower shop

    Before we start this mini-tutorial, let’s go over a couple of things..

  • http://www.goldstore24.com/ schmuck

    websites and all kinds of applications online are taking Facebook
    integration more seriously. One of those popular elements is Facebook
    Comments.

  • http://www.purecigs.com/ Kumren

    e-commerce websites and all kinds of applications online are taking
    Facebook integration more seriously. One of those popular elements is
    Facebook Comments.

  • http://www.jacklinedesolle.com/ косметика для лица

    One of those popular elements is Facebook Comments.

  • Nor Iman

    Thanks a lot :)  

  • Steve

    I`m with Wites….MUCH MUCH simpler using the plug-in.

  • http://twitter.com/Aliencide Aliencide Producer

    It’s not really worth it since people can easily “Like” the post if they want. Disqus comments are much better solution.

  • juniosongwriter

    test

Previous post:

Next post: