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

Three Ways of Monetizing Your Blog

I would say for about 99% of webmasters out there, part of the point of their website will for it to be to pay for itself, and eventually earn them a profit. This is harder for sites that are built around providing info instead of just selling some sort of goods, but not impossible at […]

Interview With Music Entrepreneur & Red Tape Management’s Founder, Chloe Freedman

1- Hello Chloe, can you please tell us a bit about you? Hey! Firstly thank you for taking the time to speak with me. I am a 31-year-old music entrepreneur and music manager. I grew up in London, UK and have been in the music industry for 7+ years now. Before I turned to the […]

Top 5 Lead Generation Strategies To Grow Your Landscaping Business

Considering that it employs more than 1 million people, with market size of USD$105.1 billion, it’s safe to say that the landscaping industry in the U.S. is booming. This is enticing news if you are interested in starting your own landscaping business. (1) If you’ve already started one or are still in the planning stage, […]

Best CRM for Non-Profits: Why HubSpot CRM Offers More Than Just Contact Management

HubSpot CRM transforms non-profit operations by delivering a comprehensive CRM solution that goes beyond basic contact management to empower stronger relationships with donors, volunteers, and beneficiaries. For non-profit organizations focused on maximizing impact, HubSpot’s platform provides integrated tools that address unique challenges like donor retention, volunteer engagement, and impact reporting. The nonprofit sector faces significant […]