Optimize the CommentLuv wordpress plugin

CommentLuv is a wordpress comment plugin powered by Comment Luv. This plugin is compatible with the latest WordPress version up to now, it helps give something back to every single commentator as well as entice them to come back and visit more often by automatically adding a titled link to their last blog post at the end of their comment. In this article, I will show you how to make a bit optimization for CommentLuv.
As you see, Intenseblog.com is now using CommentLuv as website comment, this is a Win-Win comment system that’s not only grow the community but also the SEO ranking of both the website owner and the commentator:
The plugin fetches the feed found at commenters site URL while they type their comment and extracts the last blog post title with link and displays it below the comment form. When they submit their comment, the last blog post link gets added on the end of their comment for all to see.
The installation process is very simple, you need to download the CommentLuv plugin at:
http://comluv.com/download/commentluv-wordpress/ and follow the plugin instruction. You can read more about CommentLuv at the More resources section of this post, and now I want to show you how to optimize this plugin for your website.
Maybe your websites had already called the Jquery script (or you use another jquery version) but after you install the CommentLuv, the plugin calls for Jquery a second times; Andy Bailey (the admin of CommentLuv) was told that “wp_enqueue_script is already built to do that , it shouldnt show 2x jquery calls unless your theme has it hard coded” , so let check your website before we start to do this:

Besides the Jquery script, the plugin also calls for two other script are: hoverIntent.js and commentluv.js, so that you should:
1. Repair step.
The header data for config commentluv needs to be in the header section of your website and it should be dynamic but if you want to improve the performance a bit more, you should follow this:
View your website source and then copy the following source:
<script type='text/javascript'>
/* <![CDATA[ */
var cl_settings = {
.... // copy all of this source (it's different for a specific website)
usetemplate: ""
};
/* ]]> */
…then paste it to your footer.php in your theme and add two wordpress conditional tags at the top and bottom:
<?php if (is_single()) { ?>
<script type='text/javascript'>
/* <![CDATA[ */
var cl_settings = {
.... // the source you have copied before
usetemplate: ""
};
/* ]]> */
</script>
<?php } ?>
When you change plugin settings please modified this script so it will not break the plugin use. Please aware what you are doing. (Thanks Andy Bailey for that)
2. Combine the javascript.
First, you should combine the content of hoverIntent.js and commentluv.js into 1 file, ex: combine.js and then add this line to the footer.php of your theme, for example:
<script type="text/javascript" src="http://www.domainexample.com/.../combine.js" ></script>
3. Modify the Plugin.
Second, you need to edit the commentLuv.php (in the plugin folder) by deleting these lines:
wp_enqueue_script ( 'jquery' );
global $wp_version;
// see if hoverintent library is already included (2.7 >)
if (version_compare ( $wp_version, "2.8", "<" )) {
wp_enqueue_script ( 'hoverIntent', '/' . PLUGINDIR . '/' . dirname ( plugin_basename ( __FILE__ ) ) . '/js/hoverIntent.js', array ('jquery' ) );
} else {
wp_enqueue_script ( 'hoverIntent', '/' . WPINC . '/js/hoverIntent.js', array ('jquery' ) );
}
wp_enqueue_script ( 'commentluv', $this->plugin_url . 'js/commentluv.js', array ('jquery' ) );
4. Combine the CommentLuv Css
Copy the content of cl_style.css (in the plugin folder) to your main style css file and then deleting these lines in commentLuv.php:
add_action ( 'wp_head', array (&$this, 'commentluv_style' ) ); // add style sheet to header
and:
// hook the head function for adding stylesheet
function commentluv_style() {
echo '<link rel="stylesheet" href="' . $this->plugin_url . 'style/cl_style.css" type="text/css" />';
}
Save and then upload it again to the plugin folder.
In those steps above, you can use some online minify services like http://www.cleancss.com for compress css and don’t forget to read this article: How to: optimize wordpress blog for maximum speed.
And yes, it’s finished, after a few modifications, your website now working more smoothly with CommentLuv plugin, maybe you will happy with this small trick.
[...] This post was mentioned on Twitter by Jennifer R, Jennifer R. Jennifer R said: Optimize the CommentLuv wordpress plugin http://goo.gl/fb/8647W [...]
you do know that wp_enqueue_script will only queue a script once right? if you are seeing jquery twice in your header then it means something else has hardcoded the call. Maybe another plugin?
fyi, the commentluv.js script that is supposed to be included in the head is needed to make commentluv work on this page which it isn’t doing right now :(
Hi Andy Bailey, I’ve try to comment on this page, everything’s going fine :) with this trick but you always need to redo the “Repair step” when you update configuration of the plugin.
commentluv.js should be included in the head but you can try put it in the bottom of the website, if anything fine let’s use it :).
Voley Ant´s last blog ..Sony đẩy mạnh tiến trình 3D tại Display Week 2010
I’ve updated my article before I saw your comment, I don’t know why Akismet mark your comment as spam :(, thanks for your instruction.
Very helpful info, Comment Luv seems to be spreading , but not as quickly as might have been anticipated , guess web masters cant see the advantage
Of course, but when you are using this technique on the big website with various java-scripts, reduce any connection will help a lot.
Thank you for linking to my post, ‘Sneaky CommentLuv Trick’.
You’ve put together a very comprehensive article about CommentLuv, people will certainly find this really useful.
Warmest regards,
Karl
Karl Foxley´s last blog ..WordPress Banner Rotator Plugin Ad Squares Affiliate Widget
[...] Optimize the CommentLuv wordpress plugin [...]
Optimize the CommentLuv wordpress plugin…
CommentLuv is a wordpress comment plugin powered by Comment Luv. In this article, I will show you how to make a bit optimization for CommentLuv….
[...] Optimize the CommentLuv wordpress plugin [...]
[...] Optimize the CommentLuv wordpress plugin [...]
[...] Optimize the CommentLuv wordpress plugin [...]
[...] Read more: Optimize the CommentLuv wordpress plugin [...]
Yeah, optimize comment luv plugin is very great for our blog
nice overview :)
pearl set´s last blog ..Physical properties of Pearl
I very like your website.This post was a time saver! Thanks.
Hi, i;m have same interesting with you and i found your website from google. You give nice info for wordpress plugin and it’s really informatif. Can i copy your post into my blog ?
WordPress Tricks´s last blog ..Post Teaser v401 WP Plugin
Of course if you place a source link to my article :)
very usefull plugin,thanks for sharing
This seems like a nice trick but major problem with this process is that it will require manual intervention with each update.
I personally prefer to use WP-Super-Cache + Autoptimizer plugins. First creates static pages for quick page load and second combines CSS and javascript for you. Not perfect setup but my tests have proven it speeds up the site a LOT!
…and no need to worry about code changes when plugin is updated.
Alex Sysoef´s last blog ..Beware Of HostICan Hosting Fraud And Consumer Scam
Thanks for sharing this information on optimizing the wordpress CommentLuv Plugin. This plugin is great for getting content on the site and providing a quality backlink for those that leave a comment.
Larry J @ Child Wonder Woman Costume´s last undefined ..Response cached until Sat 14 @ 16:42 GMT (Refreshes in 24.00 Hours)
can i implement this optimization in WP 3.01??
iphone information´s last blog ..Half Life Episode ad
Of course, you can do with that WordPress version, good luck.