Why seek to differentiate your own comments on your blog?

Because it will allow your visitors to identify and easier to follow the conversation. Some themes for WordPress offer this feature by default, but here’s a quick guide to differentiate the author’s comments.

unique-2

 

Locate the style attributed to comments

Look in your stylesheet (usually style.css file) style applied to comments. It should look like this:

comment {
background:#3F3F3F;
margin:0 0 6px;
padding:12px 12px 6px;
}

Create a second style for the author’s comments

Now you’ll create a second class that applies to the author’s comments. The simplest is to use the same style with changing the background color. Your style will look like this:

comment-author {
background:#3E3E3E;
margin:0 0 6px;
padding:12px 12px 6px;
}

Locate the loop to display the comments

Then open the comments.php file and find the loop that allows the display of all comments:
Inside is the function that calls the class that stylized comments.

Insert a condition

Just  add a condition for the class how author-created earlier is called if the author of the commentary is also the author of the ticket:

<?php
if($comment->user_id == $post->post_author) {
$class = 'comment-author';
} else {
$class = 'comment';
}
?>
<div>
<?php comment_text() ?>
</div>

3 COMMENTS

  1. Wonderful Tutorial, as always! I’ll be sure to use this. Also, is there a way to create differentiate wordpress usergroups also?

  2. Everyone wishes this. Though I am not so good in css, I searched for some tuts in net for this when customising thesis theme. but u done a good job by making this tut applicable to all the themes.

Comments are closed.