678-807-9676 hi@yazminmedia.com

Highlight Author Comments in WordPress

Before I comment on a blog, I like to take a look at post comments, to see if an author is active on the site. It’s a pet peeve, but I dislike to comment on blogs where the author doesn’t seem to be interested in fostering a community. I guess I like for my input to be read and possibly valued… call me difficult. I will live.

So since it’s something I value highly in blogs I frequent, I make it a point to make sure any blogs I work on make it easy to distinguish author comments in a blog post’s comment thread. While some themes don’t think of this small, but important usability feature, it’s very easy to setup on your own site.

It’s as simple as these 3 steps.

1. Verify comments.php using wp_list_comments(). Since version 2.7.0, WordPress added the wp_list_comments() function. It automatically adds a “comment-author-admin” class to the LI element wrapping the author’s comment.

However, if your theme doesn’t use wp_list_comments() to display the comments, you will need to add your class to the existing list of classes by:

First, registering a filter –

Second, defining the function-

And change the “1” to match the id of the author you want to highlight.

2. Edit your theme’s style.css to add your new author class:

Make sure to change “new-author-comment-class-name” to use the WordPress default of “comment-author-admin” or whatever you created to replace “my-css-class” in the previous step.

And that’s it! Now you can customize your author comments in any way you want!