How to Add Facebook Comments in WordPress Manually

Well, Many of the times you want to use this option to add comments at the end of your post. But when you try to use Facebook comments at the end of the post by using a plugin it does not go at your desired location because you may be using some other plugins like related posts, navigation buttons etc. You want you sequence like this – related posts- navigation buttons-Facebook comments. But when adding through plugin it always disturbs you. Here you need to put the Facebook codes manually into your index.php or comments.php file. I am writing the step by step guide here.

1. Create a Facebook app. at following link – https://developers.facebook.com/apps

2. For comments only you do not need to go into much detailed configuration of an app on facebook. as soon as you have named it and You’re redirected to App>AppName>Basic , just copy the App ID and App Secret to notepad and you’re done at here with creating new app. Goto Step 3.

3. Go to Following Link https://developers.facebook.com/docs/reference/plugins/comments/

You should keep the default URL what ever is written there fill out the form with rest requirements like your comments form’s default width, number of posts to show, color scheme and finally click on get code. You’ll be shown a new dialog box within your browser which have two type of codes.

4. Choose the respective app through which you want to control your comments by seeing this option above the code: “This script uses the app ID of your app:”

5. Copy the code from first box and go to WordPress admin area >Appearance>Editor – on right side you’ll see Templates>Header. click and open the header and go to its bottom paste the copied code at the bottom of the header.php file and update it.

6. Now Copy the 2nd box code put it into the notepad file. here you need to make a little changing manually , because your default URL to comment is not defined here yet and you can not write all your pages/poss manually to each page at the end. So here you need to put the php get code so that WordPress could get the each post automatically as it gets the comments at the end of each page if enabled. So in the copied link. You can replace the “www.example.com” with “<?php the_permalink() ?>” and you code will look like:

<div data-href=”<?php the_permalink() ?>” data-num-posts=”5″ data-width=”490″></div>

7. Once you’ve done this. Go to WordPress Admin>Appearance>Editor>Templates (on right side)> You can paste the above code. at the top of the comments.

8. If you don’t want to use the WordPress default comments then you can simple cut all the default codes from there and save with you some where and paste only the fb comment code there give at number 6.

You’re Done.