How To: Highlight Author Comments in WordPress

I recently realized that my new theme doesn’t display author comments in a different color than regular comments, so I struck out to fix the issue.

I regard author comment highlighting as a major feature or lack thereof for any theme. It should be mandatory, as it makes it easy to scan and find the original author’s comments. It also keeps a rude commenter from posting under your name and having readers believe it is actually your comment. You could also use colored comment highlighting on a multi-author blog to note comments by writers from the site who didn’t actually write said post.

Anyways, on to the details.

Note that my theme (MNML), uses Sandbox as a backend. This makes fixing this issue really easy.

If your theme is not based on Sandbox, use Matt Cutts’ howto to add author highlighting.

If your theme is based on Sandbox, follow along a couple of easy steps.

Sandbox uses lots of semantic markup, to make it easier for theme designers to style using only a stylesheet. This makes it easy for us to identify comments by the post author.

Each comment includes several css classes, including bypostauthor if the comment author is also the author of the post.

So, go to your theme’s style.css file and add the following at the bottom:


.bypostauthor {
background-color: #COLORCODE !important;
}

Change the COLORCODE to a six digit html color code and you are set.

Currently, I am using this code to set my own comments to have a red background:


.bypostauthor {
background-color: #FF0000 !important;
}

If editing CSS makes you queasy (hey, I understand, I was once a newbie, but editing CSS files makes for easy learning), try one of these many plugins.

One thought on “How To: Highlight Author Comments in WordPress”

Comments are closed.