WordPress author comment highlighting

I’ve noticed a few people doing ‘author comment highlighting’ on other blogs, and thought it was kinda neat. How often are you reading through comments on a blog and not realizing that the person commenting is the owner of the blog?

Well, why not highlight your own comments on your own blog so your visitors know it’s you?

Here’s how I added it to this blog:

1) I decided to highlight the comments based on my e-mail address. This means that every comment post that uses my e-mail will be marked as ‘special.’

To do this I used a small snippet of PHP code (new code is bold):

<li id="comment-<?php comment_ID() ?>"<?php if ($comment->comment_author_email == "geoff@deconcept.com") { ?> class="mycomment"<?php } ?>>

2) Edit your stylesheet so your posts are different. Since I added the class mycomment to the comments I make, I added this to my stylesheet:

ol#commentlist li.mycomment {
   background-color: #fbfbfb;
   border: solid 1px #457AA5;
}

3) Make sure nobody can post comments by pretending to be you:

I think everyone should do this on their blog anyway, but here it comes in extra handy. I went into ‘options ->discussion’ in wordpress and added my e-mail address to the list under ‘Comment Moderation.’ This assures that if a comment containing my e-mail address anywhere in the post, the comment will be held for approval by me. So every time I post a comment I’ll have to approve it before it shows up, but this isn’t really a big deal and takes almost no time at all to do.

I’m sure there are ways to improve this and make it better, like checking all of the author e-mail addresses, and possibly giving each author their own unique css class so they can each have their own look, and then packaging all of this up into a WordPress plugin… But I’m much too lazy for that, and since this works fine for my single user blog, I’ll probably just leave it like this.

UPDATE (4-28-05): Just saw this post on the WordPress support blog that updates this for use with WordPress 1.5 and also supports alternate post highlighting as well.