BM-Comment-Highlight Guide
January 28, 2008 | Web Design
In my excitement to get the BM-Comment-Highlight plugin out yesterday I forgot to tell you how to actually use the thing. Also since posting it yesterday I have though of another feature for the plugin so I have updated it accordingly.
How to use BM-Comment-Highlight
To use the plugin all you have to do is include a single php function call in your wordpress loop. This will return to you a string that you can use as a class in any way you see fit.
<?php foreach ( $comments as $comment ) {
$commentClass = bm_commentHighlight(); ?>
<li class=”<?php echo $commentClass; ?>”>
<?php comment_text(); ?>
</li>
<?php } ?>
When the function is called you will get a number of classes returned (most likely more than one). These let you style the comment appropriately.
The classes you get are:
- author - the commenter is the post author
- reader - the commenter is simply a reader of the blog
- user - the commenter is a registered user
- userID_# - the # is the user id of the registered user that has commented
- pingback - the comment is a pingback
- trackback - the comment is a trackback
Updates?
The update to the plugin is the additional feature of telling you if the comment is a comment, a trackback, or a pingback. This will let you style your incoming links in a more effective way.

Comments »
February 1, 2008
I downloaded it like a minute ago and am testing it in my new theme. I’ll be back to let you know how it went. Although I should say you should give like a little preview of it at least on your plugin page. But it’s just a thought.
February 3, 2008
… is there a way to get it and avoid downloads?
February 14, 2008
Hi Ben-
Loyal follower here -for Regulus
Any chance of getting a more bold text on the left side categories?
Any chance to have a larger font here-
thanks so much-
Jay
February 14, 2008
Jenny - there’s a screenshot up the top there. Is that not good enough?
CodeOdd - it doesn’t work on wordpress.com blogs I’m afraid
Jay - that seem unrelated to the plugin?
Regardless, these things are easy to change in the themes css files if you have access to edit them.
February 21, 2008
looool again Ben link is not working
February 21, 2008
this comment is because i forgot to check the notify me box
February 21, 2008
The link to download the plugin doesn’t work…
February 21, 2008
http://wordpress.org/extend/pl...
i got the link from word press
February 21, 2008
Aaarghh - they changed it back to how it was originally!
I’ll change them all again :S
February 22, 2008
im lost as to where to put this code and i think im pretty code snazzy
February 23, 2008
I’m an idiot. Will you please explain to me where you would place this? Please talk like you are speaking to a 5 year old, and then maybe I will get it.
:O)
March 1, 2008
Hey. Great plugin, exactly what I have been looking for. I put the code into the comment.php file. So far so good - but how exactly do I define the classes?
Cheers.
March 2, 2008
I love the idea, and have been looking for something similar for a while, but after putting the code in my template, my comments no longer load and I get an error: “Warning: Invalid argument supplied for foreach()”.
Any ideas?
March 2, 2008
Georges - you stick the code in the comments template along with the comment loop.
Matt - I got the sample code wrong. Take another look and let me know how you get on.
Rob - the classes would be saved in the styles.css file. If you don’t know css this will be harder.
March 2, 2008
Yup, that did the trick. Excellent! Thanks Ben!
April 4, 2008
Like Kevin, I consider myself pretty up-to-speed on Wordpress and plugins and can’t get my head around the installation of this at all.
April 4, 2008
I’m afraid it’s more than a case of uploading the plugin and activating it. I couldn’t think of a nice clean way to include the comment styles so this is the best I have. If you could try to explain what you don’t understand then I will see if I can be clearer. Obviously since I made the thing I understand what’s going on so it all seems easy to me (it is, honest
)
April 4, 2008
It kept giving me PHP errors, but I spent some time trying to fix it and got it myself.
Never replied back but just got an email.
April 6, 2008
this is all you need to add to file:
wp-content/themes/yourtheme/comment.php
After:
Add:
Replace: ”
add to wp-content/themes/yourtheme/style.css
.user { css styes here}
.reader { css styes here}
.author { css styes here}
April 7, 2008
Kevin - php errors? I’m not aware of any. Glad you got there in the end
Bill - your code isn’t displaying
If you email it to me through the contact form on my about page then I will add it to your comment.