How To: Integrate Facebook Comment in Website

By | September 12, 2012

Comment system in a website is essentially needed. Especially in blogs, users feedback and doubts have to be get through this comment system. Implementing facebook comment system in our site will get more visitors. For example when a user comments ( facebook comment) on a post then all of his facebook friend will know he commented on a post and if his friend interest in that topic he will surely read that article.

There is difference between implementing facebook comment code in custom designed website and wordpress site.

To implement facebook comment in wordpress,

  • Place the first code part just after the <body>, this will be available in header.php
  • Place the second code part in post-single.php, right after the_contents(); [ NOTE:In some theme file name will vary]

[code type=html]

/* 1. Paste this below code just after the <body>*/

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

/* 2. Place the below code, where ever you want facebook comments*/

<div data-href=”<?php the_permalink(); ?>” data-num-posts=”2″ data-width=”470″ data-colorscheme=”light”></div>

[/code]

Leave a Reply

Your email address will not be published. Required fields are marked *