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(); ?>
	</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.

How was it for you? Let me know on BlueSky or Mastodon

(Please) Link to this page

Thanks for reading. I'd really appreciate it if you'd link to this page if you mention it in your newsletter or on your blog.

Related Posts

27 Jan 2008

New WordPress Plugin – BM Comment Highlight

A couple of weeks ago I mentioned how to upload plugins to WordPress.org – and now I give to you, my second WordPress plugin – bm-comment-highlight.Comment Highlight does exactly what it says on the tin. If you look around you...
27 May 2013

WordPress: 10 Years Young, What Does The Future Hold?

WordPress is now 10 years old. I started using wordpress 9 years ago – which means I joined the WordPress community early on. The reason I chose WordPress is simply because of the fabled 5 minute install process – I...
27 Oct 2013

WordPress Numeric Pagination

I’ve made quite a few WordPress themes in my time, and so I thought I would write a few blog posts sharing some of the code snippets that I find myself using repeatedly.First off is some numeric pagination using native...
20 Apr 2015

Simple PHP Colour Manipulation Functions

The other day I was updating my WordPress plugin, BM Custom Login, and I need some simple colour manipulation functions. In the plugin you can pick colours for different elements of the WordPress login interface, and I wanted to colour...
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 –...
11 May 2010

file_get_contents: A PHP Alternative to cURL

A comment on my post about cURL mentioned that file_get_contents is a simpler method to use, and in many ways it absolutely is.file_get_contents is a PHP functions that gets the contents of a file. Unlike cURL it doesn’t require any...