How to Highlight Author’s Comments in WordPress
In blog posts that generate high amount of discussion, it often becomes hard for users to track the author’s comment. Specially when the discussion is heated, it is very interesting to see author’s thoughts. In this tutorial we will share one of the easiest and simplest way to highlight author’s comments in WordPress.
There are few plugins that does this job, but you don’t need a plugin to do it. Most snippets will target and try to find author’s email, but that actually slows your site down. Why not find author’s id and change the background color so it is easily pointed out.
First you need to open your style.css in your template folder and add the following:
.authorstyle { background-color: #B3FFCC !important; }
Then you need to open your comments.php which is also located in your themes folder and find the code that looks some what like this:
<li <?php echo $oddcomment; ?>id="comment-<?php comment_ID() ?>"></li>
Replace it with:
<li class="<?php if ($comment->user_id == 1) $oddcomment = "authorstyle"; echo $oddcomment; ?>"></li>
Note you must change 1 to the user id of the author. Once you do this, your blog comments will have a different background for the author’s comment compared to the rest.
Thanks to Matt Cutts for this tutorial.
Comments
5 Responses to “How to Highlight Author’s Comments in WordPress”Share Your Opinions
Tell us what you're thinking...
and if you want a pic to show with your comment, then get gravatar!
Please make sure that you have read our Comment Policy.










This method would fail for multi-author blogs right?
You can probably add a comma and add more user IDs, but it will show all editor’s comment in highlighted version, so yes it will be a fail if you look at it that way.
In my wordpress version,I just need to add a exist class that the wordpress generates.It’s “comment-author-admin”.Maybe the class “bypostauthor” that wordpress generates also does work.
nice tutorial, thank you
Useful tip.
When I read post comments, I tend to read the author’s comments on the assumption that what he says carries more authority.
I’m OK with the CSS but never sure about the php.
You may have enticed me to start messing with the php!