|Wednesday, October 26, 2016

WordPress plugins Facebook comments 

There are loads of options out there to choose from, but this Facebook comments WordPress plugin is one of the easier ones to setup. It does only what it says it does, and doesn’t have any extra features that might complicate things.

Facebook comments

Facebook comments

In order to start using it, you will need to do all the standard stuff; download the plugin, upload it to your WordPress site, activate it, set it up and start using it. You can use shortcodes, or you can simply edit your theme files to do so. I won’t go into detail here, but you can find very specific instructions on how to do all that when you visit Facebook comments plugin’s homepage. I will note however, that I did experience the IE problem (which is also documented on plugin’s homepage), and successfully solved it.

One thing I did miss though, was the ability to show comment count outside of the post/page. Don’t get me wrong, the plugin does show comment count, but only on the post where the comment box is. I also wanted to show it on the homepage, next to a post excerpt that leads to the full post. In order to do so, you need two simple modifications:

1. Open facebook-comments.php file in your plugin directory (if you don’t have a decent editor, I recommend Notepad++) and add the following piece of code right above line number 307.

Note: The text “//NUMBER OF COMMENTS” should be displayed on that line, so use that to verify you’re in the right place.

function fbnumberofcomments($permalink) {
	$commentcount = "<fb:comments-count href=".$permalink."></fb:comments-count>";
	echo $commentcount;

2. After this is done, and you have saved your changes, use the following piece of code on your homepage to display comment count.

<?php fbnumberofcomments(get_permalink()); ?>

That’s all there is to it.
And, by the way, I’m using the plugin on this site, so why don’t you drop a comment and see how it works? You’ll make me happy, and you’ll see that it actually does what it’s supposed to do.