Pages

Highlight Author’s Comment

















Have you ever seen this on blogs where author’s comments are distinguished from other comments? Well this is a simple and easy trick.
First you need to open your style.css in your template folder and add the following:
1.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:
1<li <?php echo $oddcomment; ?>id="comment-<?php comment_ID() ?>"></li>
Replace it with:
1<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.

No comments:

Post a Comment