You’ve probably seen this done on blogs, comments by the author have a different background colour to differentiate them – it’s handy when you’re scanning comments to see the authors own response.

A lot of people use the ScriptyGoddess solution, it involves hardcoding an email address and then when you comment it checks the email address you used to comment against the hardcoded email address. So it only works for blogs where there is only one author.

If you search WordPress support for Author Comment Highlighting you will find another option which checks the email address of the commenter against the email address of the author of the post using WordPress template tags.

I used a mix of both codes to do Author Highlighting on BifSniff.com and it seems to work fine. I just changed the scriptyGoddess code to grab the author email using WordPress tags.

So the solution now looks like this:

In comments.php in your template find the comment loop:
<?php foreach ($< span class="hilite">commentsspan> as $comment) { ?>

And under it paste in the following:

<?php
$isByAuthor = false;
if($comment->comment_author_email == get_the_author_email()) {
$isByAuthor = true;
}
?>

I then found the code for the list item that represents a comment:
<li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">

and inserted the php to add an author class if the email address matches:
<li class="<?php echo $oddcomment; ?> <?php if($isByAuthor ) { echo 'authorcomment';} ?>" id="comment-<?php comment_ID() ?>">

Or you could follow the ScriptyGoddess method to insert a div around author comments. In the comments of her post there is also a way to add an author image.

I used similar code as above to simply add the text ‘(author)’ after an authors name in a comment, by changing this:
<cite><?php comment_author_link() ?> </cite> Says:

to this:
<cite><?php comment_author_link() ?> <?php if($isByAuthor ) { echo '(author)';} ?> </cite> Says:

Seems to be working pretty well for us so far!