Add Facebook Comment box in your website

You can include facebook comment box in your website. So that the users can comment on your post directly to facebook.

Inorder to use this plugin in your website you should first create an application in facebook app page, so that facebook will link your website with that application using an application id. Inorder to create an application click here.

After creating the app, you will get an application id.

Then use the following script to include the comment box in your website.

1. <html xmlns:fb=”http://ogp.me/ns/fb#”>

Include the above code in the html tag of your site.

 

2.

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

Include the above code in the body section of your page. NB. Replace the XXXX portion with your application id.

3. <fb:comments href=”http://example.com” num_posts=”2″ width=”470″></fb:comments>

Place the above code in the place where you wish to add a comment box. Replace the “http://example.com” with your page url.

You can adjust the width of the box and also the number of comments to be displayed.

Sharing is caring!

Related Posts

Leave a Comment

shares