Monday, July 4, 2022

Differentiate the author’s comments on a blog

- Advertisement -spot_img
- Advertisement -Traffic Analysts Tool

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 -Traffic Analysts Tool

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:

- Advertisement -Traffic Analysts Tool
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>
- Advertisement -
Hamza Mikou
Hamza Mikouhttp://www.mikou.net
The owner of www.blogprocess.com and many other blogs. He started making money from the internet 12+ years ago. And BlogProcess is his way to giveback and show people how to do the same. Find more about him at:
Latest news
- Advertisement -



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