Differentiate the author’s comments on a blog

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:

[sourcecode language=”css”]
comment {
background:#3F3F3F;
margin:0 0 6px;
padding:12px 12px 6px;
}[/sourcecode]

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:

[sourcecode language=”css”]
comment-author {
background:#3E3E3E;
margin:0 0 6px;
padding:12px 12px 6px;
}[/sourcecode]

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:

[sourcecode language=”php”]
<?php
if($comment->user_id == $post->post_author) {
$class = ‘comment-author’;
} else {
$class = ‘comment’;
}
?>
<div>
<?php comment_text() ?>
</div>[/sourcecode]

You May Also Like

USPA Nationwide Security Opens Doors in Tulsa Oklahoma

Leading Security Guard Company to Bring New Jobs to the Local Area July 17, 2020 // TULSA OKLAHOMA – USPA Nationwide Security, one of the nation’s top providers of security guards and fire watch services, today announced the official opening of its latest location, USPA of Tulsa Oklahoma, to be owned, managed and operated by […]

How To Reach Your Customers In 2024

Understanding the Importance of Diversified Content Understanding how to reach your customers in 2024 is integral to the success of any business. In today’s ever-evolving digital landscape, companies must diversify their content strategies to capture a broad audience. This means looking beyond traditional marketing methods and embracing innovative approaches. According to a 2029 forecast by […]

How to Find Profitable Niches with Jungle Scout’s Niche Research Tools

Are you eager to step into the dynamic world of Amazon selling, or perhaps you’re already an established seller looking to expand your product line and maximize your profits? In the fast-paced e-commerce arena, finding the right niche is akin to striking gold. It’s where your entrepreneurial journey begins and where Jungle Scout’s Niche Research […]

Why Hostgator Is The Best Choice To Start Your New Website In Time of Confinement

Recently, people have been restricted in moving from one place to the other due to the global outbreak of coronavirus disease (COVID-19). We are now placed in close confinement and most offline activities are put on hold for the moment. Nonetheless, there is an opportunity in online businesses that will take us to another phase […]