17 Aralık 2012 Pazartesi

how to use Facebook comment connect box in wordpress

Hello everyone! how are you ? i'm gonna show you how to use facebook comment box in wordpress, but let me to exlplain first what kind of benefits this provides us.

  • It's the most popular
  • Almost everybody has a Facebook account
  • Sends visitor from Facebook
  • It's threaded (replay option)
  • Allows to like, send, share


Let's do!
1- Login Facebook
2-Goto Facebook comments here
3-Enter any URL or let it default (http://example.com)*
4-Click on "Get  Code"
*we'll customize it
Look at the figure

Numbers On The Image And Their Explanations
1- It's the language of comment box, replace it with your own language, click here to learn what is yours
2-Select All and Copy them and go to wordpress dashboard >> Appearance >> Editor >> header.php, then search for "<body>" tag using Ctrl + F and paste it after(under) that opening tag.
3-It's Facebook comment box itself, you can use it wherever you want, but the best address for that is right under the end of every post, to add it under every post, first disable wordpress comment box.

How to Disable Wordpress Comment Box
Go to Appearance  >> Editor >> comments.php

Now you are in comments.php and you see the codes, do here Ctrl + A >> Ctrl + C (select all and copy) save them in a text editor in case you may use them later after all. This is really and highly recommended, i do recommend you because this is very easy step, actually there are many ways to disable wordpress comment box but you may find them hard to understand if i write all.You can search other methodes to disable wordpress comment box, it's up to you, but this is just my tip.

Delete all codes in wordpress comments.php and paste simply this one code line <?php return false; ?> then "Save Changes". Now go to single.php and paste the code group that is shown you in a square bracket with the number 3 on the image above. You can add it wherever you want in single.php but it's better adding it on old comments line.
More Tips
You have added Facebook comment box in wordpress theme but, do not allow a published comment under all posts to be appeared, every post should has their own comment, to separate a comment from others we'll use a php code that calls the every post unique URL for commenting, it's exactly this one <?php the_permalink(); ?>

The code you added in single.php should look like this
<div class="fb-comments" data-href="<?php the_permalink(); ?>" data-num-posts="5" data-width="638"></div>

Counting Your Comments

Simply add this code <fb:comments-count href="<?php echo get_permalink($post->ID); ?>"></fb:comments-count> where you want to count the comments.

In this post i've shown you how to add Facebook comment box in wordpress without a plugin, thank you very much for reading my article, you can leave a comment if you have a question in your mind.

0 yorum:

Yorum Gönder