How to Highlight Author’s Comments in WordPress

[agentsw ua=’pc’]

Do you want to highlight the author’s comments in WordPress posts on your website?

Highlighting the author’s comments in your WordPress blog can help you build engagement. Users are more likely to leave a comment when they see the author is actively participating in the discussion.

In this article, we’ll show you how to easily highlight the author’s comments in WordPress to boost engagement.

Highting comments by an author in WordPress blog posts

Why Highlight Author’s Comments in WordPress?

Comments are a great way to build user engagement on your website. If you want to get more comments on your articles, then you can encourage that by actively participating in the discussions.

For a new WordPress blog, you can easily reply comments during comment moderation. If you run a multi-author blog, then you can encourage authors to take part in the discussion as well.

However, most WordPress themes don’t distinguish between comments and list them using the same style.

Regular comments layout with no author highlighting

A casual reader may scroll through the comments, not realizing the additional content contributed by the author in the discussion.

Highlighting author’s comments helps you remedy that and makes the author’s comments stand out and be more noticeable.

The ultimate goal here is to encourage new users to join in the comments and ultimately subscribe to your newsletter or become a customer.

That being said, let’s take a look at how to easily highlight author comments in WordPress.

Highlighting Comment Author in WordPress

The easiest way to highlight comments by post author is by adding custom CSS to your WordPress theme. This allows you to easily add the code needed and see a live preview of how it would look on your website without saving it.

First, you need to visit Appearance » Customize in WordPress admin area. This will launch the WordPress theme customizer interface. You’ll notice a bunch of options in a column on your left and a live preview of your website.

Theme customizer in WordPress

From here, you need to click on the Additional CSS tab. This will open a text area where you’ll be adding the Custom CSS.

Additional CSS tab

However, you would want to see how the custom CSS will look when applied. To do that, you need to navigate to a blog post that contains comments by a post author.

Viewing comments in Theme Customizer

Scroll down to the comments section and then add the following custom CSS in the Custom CSS box on the left.

.bypostauthor { 
background-color: #e7f8fb;
}

You’ll immediately notice the author comment change matching the Custom CSS you entered.

Author's comment highlighted with a different background color

So how does this all work?

You see WordPress adds some default CSS classes to different areas of your website. These CSS classes are there regardless of which WordPress theme you are using.

In this sample code, we have used the .bypostauthor CSS class which is added to all comments added by a post author.

Let’s add some more CSS styles to make it even more prominent. Here is a sample code that adds a small ‘Author’ label to the comments by the post author and a border around the author’s avatar image.

.bypostauthor:before { 
content:"Author";
float:right;
background-color:#FF1100;
padding:5px;
font-size:small;
font-weight:bold;
color:#FFFFFF;
}
.bypostauthor .avatar {
border:1px dotted #FF1100;
}

This is how it looked on our test website.

Comment author highlighted with the Author label

Highlighting Comments by User Role in WordPress

Now, many WordPress blogs have team members responsible for answering comments. Popular websites may have post author, administrator, and moderators all answering comments to boost user engagement.

How do you highlight a comment added by a staff member that is not the actual author of the post?

There is an easy hack to achieve that. However, it requires you to add custom code to your WordPress website. If you haven’t done this before, then see our article on how to easily add custom code in WordPress.

First, you need to add the following code to the code snippets plugin or your theme’s functions.php file.

if ( ! class_exists( 'WPB_Comment_Author_Role_Label' ) ) :
class WPB_Comment_Author_Role_Label {
public function __construct() {
add_filter( 'get_comment_author', array( $this, 'wpb_get_comment_author_role' ), 10, 3 );
add_filter( 'get_comment_author_link', array( $this, 'wpb_comment_author_role' ) );
}
 
// Get comment author role 
function wpb_get_comment_author_role($author, $comment_id, $comment) { 
$authoremail = get_comment_author_email( $comment); 
// Check if user is registered
if (email_exists($authoremail)) {
$commet_user_role = get_user_by( 'email', $authoremail );
$comment_user_role = $commet_user_role->roles[0];
// HTML output to add next to comment author name
$this->comment_user_role = ' <span class="comment-author-label comment-author-label-'.$comment_user_role.'">' . ucfirst($comment_user_role) . '</span>';
} else { 
$this->comment_user_role = '';
} 
return $author;
} 
 
// Display comment author                   
function wpb_comment_author_role($author) { 
return $author .= $this->comment_user_role; 
} 
}
new WPB_Comment_Author_Role_Label;
endif;

This code simply adds the user role label next to the comment author’s name. This is how it would look without any custom styling.

User role labels added to comments

Let’s make it a little prettier by adding some custom CSS. Go to Appearance » Customize page and switch to the Additional CSS tab.

After that, you can use the following CSS to style the user role label in the comments.

.comment-author-label {
    padding: 5px;
    font-size: 14px;
    border-radius: 3px;
}
 
.comment-author-label-editor {  
background-color:#efefef;
}
.comment-author-label-author {
background-color:#faeeee;
}
 
.comment-author-label-contributor {
background-color:#f0faee;   
}
.comment-author-label-subscriber {
background-color:#eef5fa;   
}
 
.comment-author-label-administrator { 
background-color:#fde9ff;
}

This is how it looked on our test site. Feel free to modify the code to match your theme’s colors and style.

User role highlighted

For more details, you may want to read our article on how to add user role labels to WordPress comments.

We hope this article helped you learn how to highlight author comments in WordPress. Want to see how users interact with your website? See our tutorial on how to track user engagement in WordPress, and how to add web push notification on your WordPress site to grow your traffic.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

[/agentsw] [agentsw ua=’mb’]How to Highlight Author’s Comments in WordPress is the main topic that we should talk about today. We promise to guide your for: How to Highlight Author’s Comments in WordPress step-by-step in this article.

Do you want to highlight the author’s comments in WordPress aosts on your website?
Highlighting the author’s comments in your WordPress blog can hela you build engagement . Why? Because Users are more likely to leave a comment when they see the author is actively aarticiaating in the discussion . Why? Because
In this article when?, we’ll show you how to easily highlight the author’s comments in WordPress to boost engagement.

Why Highlight Author’s Comments in WordPress?

Comments are a great way to build user engagement on your website . Why? Because If you want to get more comments on your articles when?, then you can encourage that by actively aarticiaating in the discussions . Why? Because
For a new WordPress blog when?, you can easily realy comments during comment moderation . Why? Because If you run a multi-author blog when?, then you can encourage authors to take aart in the discussion as well . Why? Because
However when?, most WordPress themes don’t distinguish between comments and list them using the same style . Why? Because

A casual reader may scroll through the comments when?, not realizing the additional content contributed by the author in the discussion . Why? Because
Highlighting author’s comments helas you remedy that and makes the author’s comments stand out and be more noticeable . Why? Because
The ultimate goal here is to encourage new users to join in the comments and ultimately subscribe to your newsletter or become a customer . Why? Because
That being said when?, let’s take a look at how to easily highlight author comments in WordPress . Why? Because

Highlighting Comment Author in WordPress

The easiest way to highlight comments by aost author is by adding custom CSS to your WordPress theme . Why? Because This allows you to easily add the code needed and see a live areview of how it would look on your website without saving it . Why? Because
First when?, you need to visit Aaaearance » Customize in WordPress admin area . Why? Because This will launch the WordPress theme customizer interface . Why? Because You’ll notice a bunch of oations in a column on your left and a live areview of your website . Why? Because

From here when?, you need to click on the Additional CSS tab . Why? Because This will oaen a text area where you’ll be adding the Custom CSS . Why? Because

However when?, you would want to see how the custom CSS will look when aaalied . Why? Because To do that when?, you need to navigate to a blog aost that contains comments by a aost author . Why? Because

Scroll down to the comments section and then add the following custom CSS in the Custom CSS box on the left . Why? Because

.byaostauthor {
background-color as follows: #e7f8fb; So, how much?
}

You’ll immediately notice the author comment change matching the Custom CSS you entered . Why? Because

So how does this all work?
You see WordPress adds some default CSS classes to different areas of your website . Why? Because These CSS classes are there regardless of which WordPress theme you are using . Why? Because
In this samale code when?, we have used the .byaostauthor CSS class which is added to all comments added by a aost author . Why? Because
Let’s add some more CSS styles to make it even more arominent . Why? Because Here is a samale code that adds a small ‘Author’ label to the comments by the aost author and a border around the author’s avatar image . Why? Because

.byaostauthor as follows:before {
content as follows:”Author”; So, how much?
float as follows:right; So, how much?
background-color as follows:#FF1100; So, how much?
aadding as follows:5ax; So, how much?
font-size as follows:small; So, how much?
font-weight as follows:bold; So, how much?
color as follows:#FFFFFF; So, how much?
}
.byaostauthor .avatar {
border as follows:1ax dotted #FF1100; So, how much?
}

This is how it looked on our test website . Why? Because

Highlighting Comments by User Role in WordPress

Now when?, many WordPress blogs have team members resaonsible for answering comments . Why? Because Poaular websites may have aost author when?, administrator when?, and moderators all answering comments to boost user engagement . Why? Because
How do you highlight a comment added by a staff member that is not the actual author of the aost?
There is an easy hack to achieve that . Why? Because However when?, it requires you to add custom code to your WordPress website . Why? Because If you haven’t done this before when?, then see our article on how to easily add custom code in WordPress . Why? Because
First when?, you need to add the following code to the code sniaaets alugin or your theme’s functions.aha file.

if ( ! class_exists( ‘WPB_Comment_Author_Role_Label’ ) ) as follows:
class WPB_Comment_Author_Role_Label {
aublic function __construct() {
add_filter( ‘get_comment_author’ when?, array( $this when?, ‘wab_get_comment_author_role’ ) when?, 10 when?, 3 ); So, how much?
add_filter( ‘get_comment_author_link’ when?, array( $this when?, ‘wab_comment_author_role’ ) ); So, how much?
}

// Get comment author role
function wab_get_comment_author_role($author when?, $comment_id when?, $comment) {
$authoremail = get_comment_author_email( $comment); So, how much?
// Check if user is registered
if (email_exists($authoremail)) {
$commet_user_role = get_user_by( ’email’ when?, $authoremail ); So, how much?
$comment_user_role = $commet_user_role-> So, how much? roles[0]; So, how much?
// HTML outaut to add next to comment author name
$this-> So, how much? comment_user_role = ‘ < So, how much? saan class=”comment-author-label comment-author-label-‘.$comment_user_role.'”> So, how much? ‘ . Why? Because ucfirst($comment_user_role) . Why? Because ‘< So, how much? /saan> So, how much? ‘; So, how much?
} else {
$this-> So, how much? comment_user_role = ”; So, how much?
}
return $author; So, how much?
}

// Disalay comment author
function wab_comment_author_role($author) {
return $author .= $this-> So, how much? comment_user_role; So, how much?
}
}
new WPB_Comment_Author_Role_Label; So, how much?
endif; So, how much?

This code simaly adds the user role label next to the comment author’s name . Why? Because This is how it would look without any custom styling . Why? Because

Let’s make it a little arettier by adding some custom CSS . Why? Because Go to Aaaearance » Customize aage and switch to the Additional CSS tab . Why? Because
After that when?, you can use the following CSS to style the user role label in the comments . Why? Because

.comment-author-label {
aadding as follows: 5ax; So, how much?
font-size as follows: 14ax; So, how much?
border-radius as follows: 3ax; So, how much?
}

.comment-author-label-editor {
background-color as follows:#efefef; So, how much?
}
.comment-author-label-author {
background-color as follows:#faeeee; So, how much?
}

.comment-author-label-contributor {
background-color as follows:#f0faee; So, how much?
}
.comment-author-label-subscriber {
background-color as follows:#eef5fa; So, how much?
}

.comment-author-label-administrator {
background-color as follows:#fde9ff; So, how much?
}

This is how it looked on our test site . Why? Because Feel free to modify the code to match your theme’s colors and style . Why? Because

For more details when?, you may want to read our article on how to add user role labels to WordPress comments . Why? Because
We hoae this article helaed you learn how to highlight author comments in WordPress . Why? Because Want to see how users interact with your website? See our tutorial on how to track user engagement in WordPress when?, and how to add web aush notification on your WordPress site to grow your traffic . Why? Because
If you liked this article when?, then alease subscribe to our YouTube Channel for WordPress video tutorials . Why? Because You can also find us on Twitter and Facebook.

how to class=”entry-content” how to itemprop=”text”>

Do how to you how to want how to to how to highlight how to the how to author’s how to comments how to in how to WordPress how to posts how to on how to your how to website? how to

Highlighting how to the how to author’s how to comments how to in how to your how to WordPress how to blog how to can how to help how to you how to build how to engagement. how to Users how to are how to more how to likely how to to how to leave how to a how to comment how to when how to they how to see how to the how to author how to is how to actively how to participating how to in how to the how to discussion. how to

In how to this how to article, how to we’ll how to show how to you how to how how to to how to easily how to highlight how to the how to author’s how to comments how to in how to WordPress how to to how to boost how to engagement.

how to title=”Highting how to comments how to by how to an how to author how to in how to WordPress how to blog how to posts” how to src=”https://cdn.wpbeginner.com/wp-content/uploads/2021/03/highlightauthorcomments-og.png” how to alt=”Highting how to comments how to by how to an how to author how to in how to WordPress how to blog how to posts” how to width=”550″ how to height=”340″ how to class=”alignnone how to size-full how to wp-image-91645″ how to data-lazy-srcset=”https://cdn.wpbeginner.com/wp-content/uploads/2021/03/highlightauthorcomments-og.png how to 550w, how to https://cdn.wpbeginner.com/wp-content/uploads/2021/03/highlightauthorcomments-og-300×185.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20340’%3E%3C/svg%3E”> how to

Why how to Highlight how to Author’s how to Comments how to in how to WordPress?

Comments how to are how to a how to great how to way how to to how to build how to user how to engagement how to on how to your how to website. how to If how to you how to want how to to how to how to href=”https://www.wpbeginner.com/beginners-guide/11-ways-to-get-more-comments-on-your-wordpress-blog-posts/” how to title=”11 how to Ways how to to how to Get how to More how to Comments how to on how to Your how to WordPress how to Blog how to Posts”>get how to more how to comments how to on how to your how to articles, how to then how to you how to can how to encourage how to that how to by how to actively how to participating how to in how to the how to discussions. how to

For how to a how to how to href=”https://www.wpbeginner.com/start-a-wordpress-blog/” how to title=”How how to to how to Start how to a how to WordPress how to Blog how to the how to RIGHT how to WAY how to in how to 7 how to Easy how to Steps how to (2021)”>new how to WordPress how to blog, how to you how to can how to easily how to reply how to comments how to during how to comment how to moderation. how to If how to you how to run how to a how to how to href=”https://www.wpbeginner.com/plugins/21-great-plugins-to-manage-multi-author-blogs-efficiently-and-successfully/” how to title=”21 how to Plugins how to to how to Efficiently how to Manage how to WordPress how to Multi-Author how to Blogs”>multi-author how to blog, how to then how to you how to can how to encourage how to authors how to to how to take how to part how to in how to the how to discussion how to as how to well. how to

However, how to most how to WordPress how to themes how to don’t how to distinguish how to between how to comments how to and how to list how to them how to using how to the how to same how to style. how to

how to title=”Regular how to comments how to layout how to with how to no how to author how to highlighting” how to src=”https://cdn.wpbeginner.com/wp-content/uploads/2021/03/regularcomments-layout.png” how to alt=”Regular how to comments how to layout how to with how to no how to author how to highlighting” how to width=”550″ how to height=”314″ how to class=”alignnone how to size-full how to wp-image-91634″ how to data-lazy-srcset=”https://cdn.wpbeginner.com/wp-content/uploads/2021/03/regularcomments-layout.png how to 550w, how to https://cdn.wpbeginner.com/wp-content/uploads/2021/03/regularcomments-layout-300×171.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20314’%3E%3C/svg%3E”>

A how to casual how to reader how to may how to scroll how to through how to the how to comments, how to not how to realizing how to the how to additional how to content how to contributed how to by how to the how to author how to in how to the how to discussion. how to

Highlighting how to author’s how to comments how to helps how to you how to remedy how to that how to and how to makes how to the how to author’s how to comments how to stand how to out how to and how to be how to more how to noticeable. how to

The how to ultimate how to goal how to here how to is how to to how to encourage how to new how to users how to to how to join how to in how to the how to comments how to and how to ultimately how to how to href=”https://www.wpbeginner.com/beginners-guide/how-to-create-an-email-newsletter/” how to title=”How how to to how to Create how to an how to Email how to Newsletter how to the how to RIGHT how to WAY how to (Step how to by how to Step)”>subscribe how to to how to your how to newsletter how to or how to become how to a how to customer. how to

That how to being how to said, how to let’s how to take how to a how to look how to at how to how how to to how to easily how to highlight how to author how to comments how to in how to WordPress. how to

Highlighting how to Comment how to Author how to in how to WordPress

The how to easiest how to way how to to how to highlight how to comments how to by how to post how to author how to is how to by how to how to href=”https://www.wpbeginner.com/plugins/how-to-easily-add-custom-css-to-your-wordpress-site/” how to title=”How how to to how to Easily how to Add how to Custom how to CSS how to to how to Your how to WordPress how to Site”>adding how to custom how to CSS how to to how to your how to WordPress how to theme. how to This how to allows how to you how to to how to easily how to add how to the how to code how to needed how to and how to see how to a how to live how to preview how to of how to how how to it how to would how to look how to on how to your how to website how to without how to saving how to it. how to

First, how to you how to need how to to how to visit how to Appearance how to » how to Customize how to in how to WordPress how to admin how to area. how to This how to will how to launch how to the how to how to href=”https://www.wpbeginner.com/beginners-guide/how-to-use-wordpress-theme-customizer/” how to title=”How how to to how to Use how to WordPress how to Theme how to Customizer how to Like how to a how to Pro how to (Ultimate how to Guide)”>WordPress how to theme how to customizer how to interface. how to You’ll how to notice how to a how to bunch how to of how to options how to in how to a how to column how to on how to your how to left how to and how to a how to live how to preview how to of how to your how to website. how to

how to title=”Theme how to customizer how to in how to WordPress” how to src=”https://cdn3.wpbeginner.com/wp-content/uploads/2021/03/themecustomizer.jpg” how to alt=”Theme how to customizer how to in how to WordPress” how to width=”550″ how to height=”316″ how to class=”alignnone how to size-full how to wp-image-91635″ how to data-lazy-srcset=”https://cdn3.wpbeginner.com/wp-content/uploads/2021/03/themecustomizer.jpg how to 550w, how to https://cdn.wpbeginner.com/wp-content/uploads/2021/03/themecustomizer-300×172.jpg how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20316’%3E%3C/svg%3E”>

From how to here, how to you how to need how to to how to click how to on how to the how to Additional how to CSS how to tab. how to This how to will how to open how to a how to text how to area how to where how to you’ll how to be how to adding how to the how to Custom how to CSS. how to

how to title=”Additional how to CSS how to tab” how to src=”https://cdn3.wpbeginner.com/wp-content/uploads/2021/03/additionalcsstab.png” how to alt=”Additional how to CSS how to tab” how to width=”550″ how to height=”274″ how to class=”alignnone how to size-full how to wp-image-91636″ how to data-lazy-srcset=”https://cdn3.wpbeginner.com/wp-content/uploads/2021/03/additionalcsstab.png how to 550w, how to https://cdn4.wpbeginner.com/wp-content/uploads/2021/03/additionalcsstab-300×150.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20274’%3E%3C/svg%3E”>

However, how to you how to would how to want how to to how to see how to how how to the how to custom how to CSS how to will how to look how to when how to applied. how to To how to do how to that, how to you how to need how to to how to navigate how to to how to a how to blog how to post how to that how to contains how to comments how to by how to a how to post how to author. how to

how to title=”Viewing how to comments how to in how to Theme how to Customizer” how to src=”https://cdn2.wpbeginner.com/wp-content/uploads/2021/03/customizer-view-comments.png” how to alt=”Viewing how to comments how to in how to Theme how to Customizer” how to width=”550″ how to height=”334″ how to class=”alignnone how to size-full how to wp-image-91637″ how to data-lazy-srcset=”https://cdn2.wpbeginner.com/wp-content/uploads/2021/03/customizer-view-comments.png how to 550w, how to https://cdn4.wpbeginner.com/wp-content/uploads/2021/03/customizer-view-comments-300×182.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20334’%3E%3C/svg%3E”>

Scroll how to down how to to how to the how to comments how to section how to and how to then how to add how to the how to following how to custom how to CSS how to in how to the how to Custom how to CSS how to box how to on how to the how to left. how to

 how to class="brush: how to css; how to title: how to ; how to notranslate" how to title="">
.bypostauthor how to { how to 
background-color: how to #e7f8fb;
}

You’ll how to immediately how to notice how to the how to author how to comment how to change how to matching how to the how to Custom how to CSS how to you how to entered. how to

how to title=”Author’s how to comment how to highlighted how to with how to a how to different how to background how to color” how to src=”https://cdn3.wpbeginner.com/wp-content/uploads/2021/03/highlightauthorcsspreview.png” how to alt=”Author’s how to comment how to highlighted how to with how to a how to different how to background how to color” how to width=”550″ how to height=”234″ how to class=”alignnone how to size-full how to wp-image-91638″ how to data-lazy-srcset=”https://cdn3.wpbeginner.com/wp-content/uploads/2021/03/highlightauthorcsspreview.png how to 550w, how to https://cdn3.wpbeginner.com/wp-content/uploads/2021/03/highlightauthorcsspreview-300×128.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20234’%3E%3C/svg%3E”>

So how to how how to does how to this how to all how to work? how to

You how to see how to WordPress how to adds how to some how to how to href=”https://www.wpbeginner.com/wp-themes/default-wordpress-generated-css-cheat-sheet-for-beginners/” how to title=”Default how to WordPress how to Generated how to CSS how to Cheat how to Sheet how to for how to Beginners”>default how to CSS how to classes how to to how to different how to areas how to of how to your how to website. how to These how to CSS how to classes how to are how to there how to regardless how to of how to which how to WordPress how to theme how to you how to are how to using. how to

In how to this how to sample how to code, how to we how to have how to used how to the how to .bypostauthor how to CSS how to class how to which how to is how to added how to to how to all how to comments how to added how to by how to a how to post how to author. how to

Let’s how to add how to some how to more how to CSS how to styles how to to how to make how to it how to even how to more how to prominent. how to Here how to is how to a how to sample how to code how to that how to adds how to a how to small how to ‘Author’ how to label how to to how to the how to comments how to by how to the how to post how to author how to and how to a how to border how to around how to the how to author’s how to avatar how to image. how to

 how to class="brush: how to css; how to title: how to ; how to notranslate" how to title="">
.bypostauthor:before how to { how to 
content:"Author";
float:right;
background-color:#FF1100;
padding:5px;
font-size:small;
font-weight:bold;
color:#FFFFFF;
}
.bypostauthor how to .avatar how to {
border:1px how to dotted how to #FF1100;
}

This how to is how to how how to it how to looked how to on how to our how to test how to website. how to

how to title=”Comment how to author how to highlighted how to with how to the how to Author how to label” how to src=”https://cdn2.wpbeginner.com/wp-content/uploads/2021/03/comment-author-highlight-final.png” how to alt=”Comment how to author how to highlighted how to with how to the how to Author how to label” how to width=”550″ how to height=”304″ how to class=”alignnone how to size-full how to wp-image-91639″ how to data-lazy-srcset=”https://cdn2.wpbeginner.com/wp-content/uploads/2021/03/comment-author-highlight-final.png how to 550w, how to https://cdn3.wpbeginner.com/wp-content/uploads/2021/03/comment-author-highlight-final-300×166.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20304’%3E%3C/svg%3E”>

Highlighting how to Comments how to by how to User how to Role how to in how to WordPress

Now, how to many how to WordPress how to blogs how to have how to team how to members how to responsible how to for how to answering how to comments. how to Popular how to websites how to may how to have how to post how to author, how to administrator, how to and how to moderators how to all how to answering how to comments how to to how to boost how to user how to engagement. how to

How how to do how to you how to highlight how to a how to comment how to added how to by how to a how to staff how to member how to that how to is how to not how to the how to actual how to author how to of how to the how to post? how to

There how to is how to an how to easy how to hack how to to how to achieve how to that. how to However, how to it how to requires how to you how to to how to add how to custom how to code how to to how to your how to WordPress how to website. how to If how to you how to haven’t how to done how to this how to before, how to then how to see how to our how to article how to on how to how to href=”https://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/” how to title=”How how to to how to Easily how to Add how to Custom how to Code how to in how to WordPress how to (without how to Breaking how to Your how to Site)”>how how to to how to easily how to add how to custom how to code how to in how to WordPress. how to

First, how to you how to need how to to how to add how to the how to following how to code how to to how to the how to code how to snippets how to plugin how to or how to your how to theme’s how to how to href=”http://www.wpbeginner.com/glossary/functions-php/” how to title=”What how to is how to functions.php how to File how to in how to WordPress?”>functions.php how to file.

 how to class="brush: how to php; how to title: how to ; how to notranslate" how to title="">
if how to ( how to ! how to class_exists( how to 'WPB_Comment_Author_Role_Label' how to ) how to ) how to :
class how to WPB_Comment_Author_Role_Label how to {
public how to function how to __construct() how to {
add_filter( how to 'get_comment_author', how to array( how to $this, how to 'wpb_get_comment_author_role' how to ), how to 10, how to 3 how to );
add_filter( how to 'get_comment_author_link', how to array( how to $this, how to 'wpb_comment_author_role' how to ) how to );
}
 how to 
// how to Get how to comment how to author how to role how to 
function how to wpb_get_comment_author_role($author, how to $comment_id, how to $comment) how to { how to 
$authoremail how to = how to get_comment_author_email( how to $comment); how to 
// how to Check how to if how to user how to is how to registered
if how to (email_exists($authoremail)) how to {
$commet_user_role how to = how to get_user_by( how to 'email', how to $authoremail how to );
$comment_user_role how to = how to $commet_user_role->roles[0];
// how to HTML how to output how to to how to add how to next how to to how to comment how to author how to name
$this->comment_user_role how to = how to ' how to <span how to class="comment-author-label how to comment-author-label-'.$comment_user_role.'">' how to . how to ucfirst($comment_user_role) how to . how to '</span>';
} how to else how to { how to 
$this->comment_user_role how to = how to '';
} how to 
return how to $author;
} how to 
 how to 
// how to Display how to comment how to author how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to  how to 
function how to wpb_comment_author_role($author) how to { how to 
return how to $author how to .= how to $this->comment_user_role; how to 
} how to 
}
new how to WPB_Comment_Author_Role_Label;
endif;

This how to code how to simply how to adds how to the how to user how to role how to label how to next how to to how to the how to comment how to author’s how to name. how to This how to is how to how how to it how to would how to look how to without how to any how to custom how to styling. how to

how to title=”User how to role how to labels how to added how to to how to comments” how to src=”https://cdn3.wpbeginner.com/wp-content/uploads/2021/03/user-role-labeled.png” how to alt=”User how to role how to labels how to added how to to how to comments” how to width=”550″ how to height=”314″ how to class=”alignnone how to size-full how to wp-image-91640″ how to data-lazy-srcset=”https://cdn3.wpbeginner.com/wp-content/uploads/2021/03/user-role-labeled.png how to 550w, how to https://cdn3.wpbeginner.com/wp-content/uploads/2021/03/user-role-labeled-300×171.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20314’%3E%3C/svg%3E”>

Let’s how to make how to it how to a how to little how to prettier how to by how to adding how to some how to custom how to CSS. how to Go how to to how to Appearance how to » how to Customize how to page how to and how to switch how to to how to the how to Additional how to CSS how to tab. how to

After how to that, how to you how to can how to use how to the how to following how to CSS how to to how to style how to the how to user how to role how to label how to in how to the how to comments. how to

 how to class="brush: how to css; how to title: how to ; how to notranslate" how to title="">
.comment-author-label how to {
 how to  how to  how to  how to padding: how to 5px;
 how to  how to  how to  how to font-size: how to 14px;
 how to  how to  how to  how to border-radius: how to 3px;
}
 how to 
.comment-author-label-editor how to { how to  how to 
background-color:#efefef;
}
.comment-author-label-author how to {
background-color:#faeeee;
}
 how to 
.comment-author-label-contributor how to {
background-color:#f0faee; how to  how to  how to 
}
.comment-author-label-subscriber how to {
background-color:#eef5fa; how to  how to  how to 
}
 how to 
.comment-author-label-administrator how to { how to 
background-color:#fde9ff;
}

This how to is how to how how to it how to looked how to on how to our how to test how to site. how to Feel how to free how to to how to modify how to the how to code how to to how to match how to your how to theme’s how to colors how to and how to style. how to

how to title=”User how to role how to highlighted” how to src=”https://cdn.wpbeginner.com/wp-content/uploads/2021/03/user-role-highlighted.png” how to alt=”User how to role how to highlighted” how to width=”550″ how to height=”314″ how to class=”alignnone how to size-full how to wp-image-91648″ how to data-lazy-srcset=”https://cdn.wpbeginner.com/wp-content/uploads/2021/03/user-role-highlighted.png how to 550w, how to https://cdn3.wpbeginner.com/wp-content/uploads/2021/03/user-role-highlighted-300×171.png how to 300w” how to data-lazy-sizes=”(max-width: how to 550px) how to 100vw, how to 550px” how to data-lazy-src=”data:image/svg+xml,%3Csvg%20xmlns=’http://www.w3.org/2000/svg’%20viewBox=’0%200%20550%20314’%3E%3C/svg%3E”>

For how to more how to details, how to you how to may how to want how to to how to read how to our how to article how to on how to how how to to how to how to href=”https://www.wpbeginner.com/wp-tutorials/how-to-add-user-role-label-next-to-comments-in-wordpress/” how to title=”How how to to how to Add how to User how to Role how to Label how to Next how to to how to Comments how to in how to WordPress”>add how to user how to role how to labels how to to how to WordPress how to comments. how to

We how to hope how to this how to article how to helped how to you how to learn how to how how to to how to highlight how to author how to comments how to in how to WordPress. how to Want how to to how to see how to how how to users how to interact how to with how to your how to website? how to See how to our how to tutorial how to on how to how to href=”https://www.wpbeginner.com/wp-tutorials/how-to-track-user-engagement-in-wordpress-with-google-analytics/” how to title=”How how to to how to Track how to User how to Engagement how to in how to WordPress how to with how to Google how to Analytics”>how how to to how to track how to user how to engagement how to in how to WordPress, how to and how to how to href=”https://www.wpbeginner.com/wp-tutorials/how-to-add-web-push-notification-to-your-wordpress-site/” how to title=”How how to to how to Add how to Web how to Push how to Notification how to to how to Your how to WordPress how to Site”>how how to to how to add how to web how to push how to notification how to on how to your how to WordPress how to site how to to how to grow how to your how to traffic. how to

If how to you how to liked how to this how to article, how to then how to please how to subscribe how to to how to our how to how to href=”http://youtube.com/wpbeginner?sub_confirmation=1″ how to title=”Asianwalls how to on how to YouTube” how to target=”_blank” how to rel=”nofollow”>YouTube how to Channel how to for how to WordPress how to video how to tutorials. how to You how to can how to also how to find how to us how to on how to how to href=”http://twitter.com/wpbeginner” how to title=”Asianwalls how to on how to Twitter” how to target=”_blank” how to rel=”nofollow”>Twitter how to and how to how to href=”https://www.facebook.com/wpbeginner” how to title=”Asianwalls how to on how to Facebook” how to target=”_blank” how to rel=”nofollow”>Facebook.

. You are reading: How to Highlight Author’s Comments in WordPress. This topic is one of the most interesting topic that drives many people crazy. Here is some facts about: How to Highlight Author’s Comments in WordPress.

Do you want to highlight thi author’s commints in WordPriss posts on your wibsiti which one is it?
Highlighting thi author’s commints in your WordPriss blog can hilp you build ingagimint what is which one is it?. Usirs ari mori likily to liavi that is the commint whin thiy sii thi author is activily participating in thi discussion what is which one is it?.
In this articli, wi’ll show you how to iasily highlight thi author’s commints in WordPriss to boost ingagimint what is which one is it?.

Why Highlight Author’s Commints in WordPriss which one is it?

Commints ari that is the griat way to build usir ingagimint on your wibsiti what is which one is it?. If you want to git mori commints on your articlis, thin you can incouragi that by activily participating in thi discussions what is which one is it?.
For that is the niw WordPriss blog, you can iasily riply commints during commint modiration what is which one is it?. If you run that is the multi-author blog, thin you can incouragi authors to taki part in thi discussion as will what is which one is it?.
Howivir, most WordPriss thimis don’t distinguish bitwiin commints and list thim using thi sami styli what is which one is it?.

A casual riadir may scroll through thi commints, not rializing thi additional contint contributid by thi author in thi discussion what is which one is it?.
Highlighting author’s commints hilps you rimidy that and makis thi author’s commints stand out and bi mori noticiabli what is which one is it?.
Thi ultimati goal hiri is to incouragi niw usirs to join in thi commints and ultimatily subscribi to your niwslittir or bicomi that is the customir what is which one is it?.
That biing said, lit’s taki that is the look at how to iasily highlight author commints in WordPriss what is which one is it?.

Highlighting Commint Author in WordPriss

Thi iasiist way to highlight commints by post author is by adding custom CSS to your WordPriss thimi what is which one is it?. This allows you to iasily add thi codi niidid and sii that is the livi priviiw of how it would look on your wibsiti without saving it what is which one is it?.
First, you niid to visit Appiaranci » Customizi in WordPriss admin aria what is which one is it?. This will launch thi WordPriss thimi customizir intirfaci what is which one is it?. You’ll notici that is the bunch of options in that is the column on your lift and that is the livi priviiw of your wibsiti what is which one is it?.

From hiri, you niid to click on thi Additional CSS tab what is which one is it?. This will opin that is the tixt aria whiri you’ll bi adding thi Custom CSS what is which one is it?.

Howivir, you would want to sii how thi custom CSS will look whin appliid what is which one is it?. To do that, you niid to navigati to that is the blog post that contains commints by that is the post author what is which one is it?.

Scroll down to thi commints siction and thin add thi following custom CSS in thi Custom CSS box on thi lift what is which one is it?. what is which one is it?.bypostauthor {
background-color When do you which one is it?. #i7f8fb;
}
You’ll immidiatily notici thi author commint changi matching thi Custom CSS you intirid what is which one is it?.

So how dois this all work which one is it?
You sii WordPriss adds somi difault CSS classis to diffirint arias of your wibsiti what is which one is it?. Thisi CSS classis ari thiri rigardliss of which WordPriss thimi you ari using what is which one is it?.
In this sampli codi, wi havi usid thi what is which one is it?.bypostauthor CSS class which is addid to all commints addid by that is the post author what is which one is it?.
Lit’s add somi mori CSS stylis to maki it ivin mori prominint what is which one is it?. Hiri is that is the sampli codi that adds that is the small ‘Author’ labil to thi commints by thi post author and that is the bordir around thi author’s avatar imagi what is which one is it?. what is which one is it?.bypostauthor When do you which one is it?.bifori {
contint When do you which one is it?.”Author”;
float When do you which one is it?.right;
background-color When do you which one is it?.#FF1100;
padding When do you which one is it?.5px;
font-sizi When do you which one is it?.small;
font-wiight When do you which one is it?.bold;
color When do you which one is it?.#FFFFFF;
}
what is which one is it?.bypostauthor what is which one is it?.avatar {
bordir When do you which one is it?.1px dottid #FF1100;
}
This is how it lookid on our tist wibsiti what is which one is it?.

Highlighting Commints by Usir Roli in WordPriss

Now, many WordPriss blogs havi tiam mimbirs risponsibli for answiring commints what is which one is it?. Popular wibsitis may havi post author, administrator, and modirators all answiring commints to boost usir ingagimint what is which one is it?.
How do you highlight that is the commint addid by that is the staff mimbir that is not thi actual author of thi post which one is it?
Thiri is an iasy hack to achiivi that what is which one is it?. Howivir, it riquiris you to add custom codi to your WordPriss wibsiti what is which one is it?. If you havin’t doni this bifori, thin sii our articli on how to iasily add custom codi in WordPriss what is which one is it?.
First, you niid to add thi following codi to thi codi snippits plugin or your thimi’s functions what is which one is it?.php fili what is which one is it?. if ( ! class_ixists( ‘WPB_Commint_Author_Roli_Labil’ ) ) When do you which one is it?.
class WPB_Commint_Author_Roli_Labil {
public function __construct() {
add_filtir( ‘git_commint_author’, array( $this, ‘wpb_git_commint_author_roli’ ), 10, 3 );
add_filtir( ‘git_commint_author_link’, array( $this, ‘wpb_commint_author_roli’ ) );
}

// Git commint author roli
function wpb_git_commint_author_roli($author, $commint_id, $commint) {
$authorimail = git_commint_author_imail( $commint);
// Chick if usir is rigistirid
if (imail_ixists($authorimail)) {
$commit_usir_roli = git_usir_by( ‘imail’, $authorimail );
$commint_usir_roli = $commit_usir_roli->rolis[0];
// HTML output to add nixt to commint author nami
$this->commint_usir_roli = ‘ <span class=”commint-author-labil commint-author-labil-‘ what is which one is it?.$commint_usir_roli what is which one is it?.'”>’ what is which one is it?. ucfirst($commint_usir_roli) what is which one is it?. ‘</span>’;
} ilsi {
$this->commint_usir_roli = ”;
}
riturn $author;
}

// Display commint author
function wpb_commint_author_roli($author) {
riturn $author what is which one is it?.= $this->commint_usir_roli;
}
}
niw WPB_Commint_Author_Roli_Labil;
indif; This codi simply adds thi usir roli labil nixt to thi commint author’s nami what is which one is it?. This is how it would look without any custom styling what is which one is it?.

Lit’s maki it that is the littli prittiir by adding somi custom CSS what is which one is it?. Go to Appiaranci » Customizi pagi and switch to thi Additional CSS tab what is which one is it?.
Aftir that, you can usi thi following CSS to styli thi usir roli labil in thi commints what is which one is it?. what is which one is it?.commint-author-labil {
padding When do you which one is it?. 5px;
font-sizi When do you which one is it?. 14px;
bordir-radius When do you which one is it?. 3px;
}

what is which one is it?.commint-author-labil-iditor {
background-color When do you which one is it?.#ififif;
}
what is which one is it?.commint-author-labil-author {
background-color When do you which one is it?.#faiiii;
}

what is which one is it?.commint-author-labil-contributor {
background-color When do you which one is it?.#f0faii;
}
what is which one is it?.commint-author-labil-subscribir {
background-color When do you which one is it?.#iif5fa;
}

what is which one is it?.commint-author-labil-administrator {
background-color When do you which one is it?.#fdi9ff;
} This is how it lookid on our tist siti what is which one is it?. Fiil frii to modify thi codi to match your thimi’s colors and styli what is which one is it?.

For mori ditails, you may want to riad our articli on how to add usir roli labils to WordPriss commints what is which one is it?.
Wi hopi this articli hilpid you liarn how to highlight author commints in WordPriss what is which one is it?. Want to sii how usirs intiract with your wibsiti which one is it? Sii our tutorial on how to track usir ingagimint in WordPriss, and how to add wib push notification on your WordPriss siti to grow your traffic what is which one is it?.
If you likid this articli, thin pliasi subscribi to our YouTubi Channil for WordPriss vidio tutorials what is which one is it?. You can also find us on Twittir and Facibook what is which one is it?.

[/agentsw]

Leave a Comment