How to Highlight Author Comments in WordPress
SHARE THIS

So you finally got that long awaited popular post with a billion Digg’s and hundreds of comments. After spending quality time responding to some of your favorites you realized that your replies just got lost in the mix.

As the author you really want the readers to have an easy way to know exactly when and where your responses are so you decide to find a quick and easy solution. Why not just give your comments a different background color? I will show you how to highlight author comments in your WordPress blog. This is a lot easier than you think because at WPSwitch we are never gonna let you down. Here is a quick and super simple solution to make your replies stand out from the rest.

2-Week 30-40% OFF Promo

First you need to open your style.css (or whatever your stylesheet is named) in your template folder and add the following css:

[php]
.authorstyle { background-color: #B3FFCC !important; }
[/php]

Once you have that all done just open your comments.php which is also located in your themes folder and find the line of code that looks a bit like this:

[php]
<li <?php echo $oddcomment; ?>id="comment-<?php comment_ID() ?>"></li>
[/php]

Now replace it with this sexy new code:

[php]
<li class="<?php if ($comment->user_id == 1) $oddcomment = "authorstyle"; echo $oddcomment; ?>"></li>
[/php]

Wait! Before you wrap it all up you must change 1 to the user id of the author. Once you do this, your blog comments will have a different style for the author’s comment compared to the rest. You can simply change the background color with the css or do something really crazy like putting a gold star next to your picture. Or don’t..whatever.

Are you the lazy type? If you are then maybe you should try the Highlight Author Comments WordPress plugin by Rob Marsh. Just upload and activate.

Highlight Author Comments automatically displays comments made by a post’s author in a distinctive style with no need to edit your template files, etc. All you do is provide a snippet or two of CSS styling to be applied to author posts.

.thank {Matt Cutts for this little trick.}

19,612 Website Templates and Themes From $3