Today i'm going to show you how to add facebook comment box to your blog.It is not difficult.Lets follow me.
First go to this link - https://developers.facebook.com/setup/
Then fill it with your details.
Yow will create a app id for your blog by this step.
Remember the app id.
Now go to design and select edit html.
Put a tick for expand widget templates.
Press ctrl+f at once.
Search for <body> tag.
Then add this code after <body> tag.
<!-- Facebook SDK script Code -->
<div id='fb-root'/>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'YOUR APPID',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
FB.Event.subscribe('comments.create', function(response) {
// do something with comments.create like notify me when new comment
});
FB.Event.subscribe('edge.create', function(response) {
// do something with edge.create like notify me when someone likes something
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
<!-- End SDK script Code -->
<div id='fb-root'/>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'YOUR APPID',
status : true, // check login status
cookie : true, // enable cookies to allow the server to access the session
xfbml : true // parse XFBML
});
FB.Event.subscribe('comments.create', function(response) {
// do something with comments.create like notify me when new comment
});
FB.Event.subscribe('edge.create', function(response) {
// do something with edge.create like notify me when someone likes something
});
};
(function() {
var e = document.createElement('script');
e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
e.async = true;
document.getElementById('fb-root').appendChild(e);
}());
</script>
<!-- End SDK script Code -->
Replace blue letters with your app id.
Now find <b:if cond='data:post.allowComments'> tag
(press ctrl+f at once and search for this tag)
Add this code after this tag
<fb:comments expr:href='data:post.url' num_posts='5'
width='575'/>
Then save the template
This is not finished yet.
Now find the this code
window.fbAsyncInit = function() {
FB.init({
appId : 'YOUR APPID',
status : true, // check login status
cookie : true, // enable cookies to allow server to
access the session
xfbml : true // parse XFBML
Replace the blue letters with your app id
Now add this code after this one
FB.Event.subscribe('comments.create', function(response) { // do something with comments.create like notify me when new comment });
Now it is finished
1 comments:
good post. i like fb too
Post a Comment