Author Highlight is a plugin that prints out a user-specified class attribute if the comment is made by the specified author. It is useful if you would like to apply a different style to comments made by yourself.
How to use it
Author Highlight needs a few details in order to do its dirty work. You must specify the following:
- The author e-mail address
- The author name (as it is displayed when they post a comment)
- The class attribute to be printed if a match is found
You may also specify:
- The class attribute to be printed if a match is not found
With this information the plugin will then compare the set e-mail address and name with the e-mail address and name of each comment. If they both match up, then the "highlight" class attribute will be printed. If they do not match then the "default" class attribute (if there is one) will be printed.
You need to add this code to your comments.php file (in your theme's directory):
<?php author_highlight(); ?>
It needs to be withing the loop for the comments, and you want to specify it so that it outputs into a class attribute. Something like this:
<div class="<?php author_highlight(); ?>"> This is a comment. </div>
Then you will need to edit the settings within the plugin file. This is the important part:
$author_highlight = array ( "class_name_highlight" => "highlighted", "class_name_else" => "", "email" => "email@example.com", "author" => "Your Name" );
It is worth noting two things at this point. The first is that the plugin does not print out a value like:
instead, it would just print out
This is because it is possible to assign more than one class attribute to an element, and it would be stupid to limit anyone by printing the class bit too. The second is related. Although I have talked about using this plugin for class attributes all the way through, it is obviously possible to use this plugin to selectively print out just about anything within the comment loop if you see the need.
The latest version is 1.0. Download it and put it into you wp-content/plugins directory. Make sure that there is no whitespace (as in zero, zilch, nada, nothing, none) before or after the <?php [Lots of code here] ?> block, otherwise it will not work.
NOTE: Sorry but I am not able to help you if you do not understand the workings of CSS and HTML. As in, this is a plugin for people who know what they are doing. I don't have the time to teach you about the technologies.
If you have a problem with the plugin, first make sure you have read all of the documentation on this page, and then feel free to contact me about it. If you have found a bug, or have a feature request, please file a ticket about it.
- Version 1.0 - Initial plugin release