This page explains the compatibility issue that the KeywordLuv plugin has with some WordPress themes and the options to get around it.
The Problem
KeywordLuv works by filtering the following functions:
- comment_author_link() OR get_comment_author_link()
If your theme uses one of these functions to display the comment author link, KeywordLuv will work. However, it will not work if your theme manually builds the comment author link, using the following functions:
- comment_author() OR get_comment_author() AND
- comment_author_url() OR get_comment_author_url()
From what I can tell, most themes will use the first method. However, there are themes that use the second method.
How Do I Find Out If My Theme Is Compatible?
To find out if your theme is compatible, you can either:
a) Try the plugin: Activate it, leave a comment using the Name@Keywords notation (in the Name field). If the Name part appears before the link, your theme is compatible. If it appears exactly as you typed it, it’s not compatible.
OR
b) Check your theme: Look in the comments.php file for your theme and search for comment_author_link() or get_comment_author_link(). If you can’t find one of these, then it is likely that your theme is not compatible.
Note: If you use Brian’s Threaded Comments or YATCP for threaded comments, KeywordLuv will work, as it does not use your theme’s comments.php file.
What If I Really Want To Use KeyWordLuv?
If your theme is not compatible, there are several options open to you:
1. Use KeywordLuv’s Compatibility Mode
From KeywordLuv 1.02, you can run the plugin in Compatibility Mode. Here’s how you set it up:
- Go to the KeywordLuv Options screen in the WordPress Admin area, select the Compatibility Mode setting and Save Changes.
- Use FTP to go to the wp-content/themes/[yourtheme] folder on your server and download the comments.php file.
- IMPORTANT: Make a copy of the comments.php file so you can put it back if something goes wrong.
-
Edit the comments.php file and find the line that adds the comment author’s name. It normally looks something like this:
<a href="<?php comment_author_url();?>"><?php comment_author();?> </a>
-
Add the following immediately before it, leaving the line intact:
<?php if (function_exists(‘keywordluv_name’)) keywordluv_name();?>
- Save the file and FTP it up to the wp-content/themes/[yourtheme] folder on the server, overwriting the original file.
There is one problem with this approach. In the Comments management section in the Admin area, you will not the person’s name. You will only see their keywords. There is no way around this.
2. Change Your Theme To Use comment_author_link()
This is better than using the Compatibility Mode, but is harder to implement. There is also a chance that your theme doesn’t use comment_author_link() because it does something special using the other technique. DO NOT attempt this unless you are comfortable editing themes.
- Use FTP to go to the wp-content/themes/[yourtheme] folder on your server and download the comments.php file.
- IMPORTANT: Make a copy of the comments.php file so you can put it back if something goes wrong.
-
Edit the comments.php file and find the line that adds the comment author’s name. It normally looks something like this:
<a href="<?php comment_author_url();?>"><?php comment_author();?> </a>
-
Replace this with the following:
<?php comment_author_link() ?>
- Save the file and FTP it up to the wp-content/themes/[yourtheme] folder on the server, overwriting the original file.
NOTE: The problem mentioned in the Compatibility Mode section (names not appearing in Comments management) will not occur with this approach.
3. Decide Not To Use The Plugin
Obviously, I’d like as many people to use the plugin as possible, but if it doesn’t work with your theme and you’re not comfortable with the above options, the last choice to not use KeywordLuv.
Final Thoughts
Hopefully this information will help you decide what action to take. If you need any further information, please contact me and I’ll help you if I can. Thanks for considering KeywordLuv.