BM-Comment-Highlight Guide

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 ) {
	<strong>$commentClass = bm_commentHighlight();</strong> ?>
	<li class="<?php <strong>echo $commentClass;</strong> ?>">
	<?php comment_text(); ?>
<?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


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.

Let me know what you think on Mastodon, or BlueSky (or Twitter X if you must).

WordPress News

The latest WordPress updates from the WPBriefs Podcast.

Related Posts

14 Jan 2008

A 3 step guide to getting your WordPress plugin onto

I recently got my bm-custom-login plugin accepted onto the Wordress plugin repository. In order to get it online I had to use subversion – something I’ve never used before.I found the “using svn page” on to be rather intimidating....
27 Oct 2012

Browser Shots WordPress Plugin

I didn’t realise it had been so long but in February 2010 I wrote a little blog post about creating screenshots of websites automatically.I wrote this after finding that the team at WordPress had created their own system for doing...
11 Jul 2008

New plugin : BM Admin Tweak

A couple of weeks ago I mentioned how I have customised my wordpress administration interface to make it more streamlined and usable. This is an interface I made for myself so it works the way I want it too –...
29 May 2020

Does WordPress Need a Grid System?

Justin, from WPTavern, has recently posted an article considering whether WordPress needs a grid system. As a designer, I am inclined to say yes.I have been using the Layout Grid plugin, that Justin mentions, for a couple of months now...