Add Facebook Comment box in your website

You can include a Facebook comment box on your website so that the users can comment on your post directly to Facebook.

To use this plugin on your website, you should first create an application on the Facebook app page so that Facebook will link your website with that application using an application id. In order 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 on your website.

Step 1: Include the below code in the head portion of the HTML of your site.

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

Step 2: Include the following code in the body section of your page. NB. Replace the XXXX portion with your application 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=XXXXXXXXXXXXXXX”; fjs.parentNode.insertBefore(js, fjs); }(document, ‘script’, ‘facebook-jssdk’));</script>

Step 3: Place the below code in the place where you wish to add a comment box.

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

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.

Leave a Comment

Try Our Answer Engine