How to add Facebook comment box for websites having dynamic web pages

2430

Adding facebook comment system to a particular website ;its very simple task, most of the web masters know about that process.But the limitation of this normal process is that the same comment was appearing on all web pages. but adding facebook comment system to a dynamic web sites having large number of web pages and also it will grow each day .Such dynamic websites need something different;that is if all the pages shows the same comment,it will became inappropriate.This task got me confused for a while,and finally I found a new solution .I hope that will works fine .I used the same technique in this website also.

Follow these steps..

I hope normally all webmasters knows about the initial steps for creating a facebook apps for particular Facebook social plugin.Its very easy..

Follow these simple steps..

1. At the head section of your website,(means in between <head> Here </head> ) add the code below:

<meta property=”fb:app_id” content=”YOUR_APP_ID” />
<meta property=”fb:admins” content=”{YOUR_PROFILE_ID}”/>

2.After that Paste the below code right after the opening <body> tag

<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>

 

3.Then Paste this code Where ever you want to comment box to appear in the body of your website

<div class=”fb-comments” data-href=”http://example.com” data-width=”470″ data-num-posts=”3″></div>
<script>

$(“.fb-comments”).attr(“data-href”, window.location.href);
</script>

 

You must change these values with your own

1.YOUR_APP_ID
2.YOUR_PROFILE_ID
3.example.com -with your own website domain

you can change these also if you like..

data-width=”your own value larger than 470″
data-num-posts=”your own value larger than 1″

That’s all..

Post Your Comments

comments

SHARE
Hai frieds I am Sajeevkumar blogger and web developer.i love blogging and very passionate about blogging because of that i Started garudacreations.com with my best friend and co founder Gireeshkumar.Through this platform i am trying to share my thoughts ideas and knowledge about different subjects. If you like this Post you can follow Garudacreations on Facebook ,twitter and other social networks