Sunday, November 24, 2024

Differentiate the author’s comments on a blog

- Advertisement -spot_img
- Advertisement -Best Managed Hosting

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

 

- Advertisement -
Best Managed Hosting

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

- Advertisement -Traffic Analysts Tool

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>
- Advertisement -
Latest news
- Advertisement -



Liquid Web Storm VPS
Related articles
- Advertisement - Traffic Analysts Tool