How To: Style Author Comments in Wordpress
Posted in: WordPress
The other day I wrote a post on How To: Customize your own style in showing the number of comments. Today I’ll be discussing on how to highlight the author’s comments. It’s just easy to follow and I know you can do it in just a few minutes.
To start of, we are going to edit your comments.php and style.css. If you are a Wordpress user definitely you know what I’m talking about. For newbies,Here’s an easy way to access your site. go to admin panel> presentation> theme editor> then just click the you want to change.
Let’s begin.
- Open the comments.php within that file. Search for the code that read as
<?php foreach ($comments as $comment) : ?>
<li class=”<?php echo $oddcomment; ?>” id=”comment-<?php comment_ID() ?>”
Remove the second line and change it using the code below. Don’t forget to modify the ones that are marked red.
<li class=”<?php if ($comment->comment_author == ‘TYPE AUTHOR’S NAME‘ &&
$comment->comment_author_email == ‘TYPE AUTHOR’S EMAIL ADDRESS‘) echo ‘authorcomment’;
else echo $oddcomment; ?>” id=”comment-<?php comment_ID() ?>”>
After you update your comments.php, we will add styles to it. Open your style.css, we are going to design the class for “authorcomment“. Look on comments section and add this code.
.authorcomment {
background: #666666;
}
This code varies on how your theme was made. Analyze the code but once you understand the principle you can apply it in your theme.














































No comments yet.