WPBeginner

Beginner's Guide for WordPress

  • Blog
    • Beginners Guide
    • News
    • Opinion
    • Showcase
    • Themes
    • Tutorials
    • WordPress Plugins
  • Start Here
    • How to Start a Blog
    • Create a Website
    • Start an Online Store
    • Best Website Builder
    • Email Marketing
    • WordPress Hosting
    • Business Name Ideas
  • Deals
    • Bluehost Coupon
    • SiteGround Coupon
    • WP Engine Coupon
    • HostGator Coupon
    • Domain.com Coupon
    • Constant Contact
    • View All Deals »
  • Glossary
  • Videos
  • Products
X
☰
Beginner's Guide for WordPress / Start your WordPress Blog in minutes
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

WPBeginner» Blog» Tutorials» How to Highlight Author’s Comments in WordPress

How to Highlight Author’s Comments in WordPress

Last updated on January 26th, 2015 by Editorial Staff
4 Shares
Share
Tweet
Share
Pin
Free WordPress Video Tutorials on YouTube by WPBeginner
How to Highlight Author’s Comments in WordPress

On most sites, it is very hard for users to track author’s comments. This is why many WordPress sites highlight their author’s comment by making it a different background color, adding an image, etc. If you want to learn how to highlight author’s comments in WordPress, then you have come to the right place. In this article, we will show you the easiest and simplest way to highlight author’s comments in WordPress.

Video Tutorial

Subscribe to WPBeginner

If you don’t like the video or need more instructions, then continue reading.

WordPress by default generates a number of CSS classes which makes it easier for designers and users to change the styles (WordPress CSS Cheat Sheet). Among those default classes that WordPress has added, one of those are specifically targeted for styling author’s comments.

The class is called .bypostauthor which can be found in the .commentlist element. All you have to do is add your custom styles by using CSS. For example, you can add your own background, your own image, etc. Note: this code will be found in your style.css file located in your theme’s folder.

.commentlist .bypostauthor {}
.commentlist li ul.children li.bypostauthor {}

This doesn’t have to be super complex. Often it is a rather simple distinction that highlights author comment. For example, Chris Coyier has a border-top with a yellow/orange color that makes his comment stand out.

Highlight Author Chris

To get something like Chris, all you have to do is add this value in those classes:

.commentlist .bypostauthor {border-top: 10px solid #e18728;}
.commentlist li ul.children li.bypostauthor {border-top: 10px solid #e18728;}

Note: we strongly recommend that you change the color to match your color scheme :)

Another example would be Matt Cutt’s site. He highlights his comment by adding a light background to his comment whereas all other comments have a white background.

Highlight Author Matt

You can do this by adding something like this in your style.css file:

.commentlist .bypostauthor {background: #e7f8fb;}
.commentlist li ul.children li.bypostauthor {background: #e7f8fb;}

Again, we strongly recommend that you change the color to match your site’s color scheme.

We hope that you find out tutorial on how to highlight author’s comment in WordPress to be helpful. The examples above are very simple, but you can go totally crazy and add background images, etc. Let us know if you have any questions.

4 Shares
Share
Tweet
Share
Pin
Popular on WPBeginner Right Now!
  • Google Analytics in WordPress

    How to Install Google Analytics in WordPress for Beginners

  • How to Start Your Own Podcast (Step by Step)

    How to Start Your Own Podcast (Step by Step)

  • How to Fix the Error Establishing a Database Connection in WordPress

    How to Fix the Error Establishing a Database Connection in WordPress

  • How to Properly Move Your Blog from WordPress.com to WordPress.org

About the Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Trusted by over 1.3 million readers worldwide.

The Ultimate WordPress Toolkit

20 Comments

Leave a Reply
  1. Rafael says:
    Dec 2, 2018 at 11:06 am

    Not work for me :(

    I use custom theme with comments.php from twenty Twenty Thirteen.

    Where can I add more CSS classes ?

    Reply
    • WPBeginner Support says:
      Dec 3, 2018 at 10:18 pm

      Hi Rafael,

      Please see our guide on how to add custom CSS in WordPress.

      Reply
  2. Irfan Ali says:
    Aug 18, 2018 at 2:41 am

    Thank you very much.

    Reply
  3. Haina says:
    May 22, 2017 at 11:45 pm

    Hi! Whenever somenone leaves a comment on my website, the author name appears in gray. How can I change that do black? Also, a “permalink” word is always bellow the date and time of the comment . How can I get rid of that? Any help will be much appreciated. Thanks.

    Reply
    • WPBeginner Support says:
      May 22, 2017 at 11:55 pm

      Hi Haina,

      Please take a look at our guide on how to style WordPress comments.

      Reply
      • Haina says:
        May 23, 2017 at 12:46 am

        Thanks for the quick reply. However, my understanding of CSS is less than “fair”. If you could give me direct instructions on how to get the comment author name in black, it would be great. If not, I understand also. Thanks.

        Reply
  4. Martin says:
    Oct 20, 2016 at 5:53 am

    How is it possible to exclude any replies to the authors comment from the styling?

    Reply
  5. Peter Huan says:
    Aug 8, 2015 at 6:01 am

    I tried to it but i could not. I was added to my theme opition by myself.
    May be i was changed “div”…
    Thank you for topic.

    Reply
  6. Fahad says:
    Jun 6, 2014 at 12:48 pm

    There is a problem with changing the background if the auther is the creator of the comment and someone else replied, since the nested reply will also have the same highlighted background!

    Reply
  7. deven says:
    Aug 4, 2013 at 11:05 am

    Nice post … but is there any plugin for doing the same ( there are some but 2-3 yers old ) looking for a new one with more customize options.

    Reply
  8. char says:
    May 25, 2013 at 12:15 am

    Is there a way to give each author (the main ones) different color comments?

    Reply
    • Editorial Staff says:
      Jun 16, 2013 at 1:08 pm

      Yes, it is possible to assign different color comments for registered users. The class would look like .comment-author-username. Replace username with the author’s username.

      Reply
  9. Ahmad Raza says:
    Apr 1, 2013 at 2:28 am

    I followed the way you described but i have not found <li id=”comment-“> template in my comments.php
    Any solution?

    Reply
    • Editorial Staff says:
      Apr 1, 2013 at 7:54 am

      Just updated the article, so it is more current.

      Reply
  10. Gretchen Louise says:
    Jan 28, 2013 at 2:42 pm

    I’d love to see this tutorial updated to apply to Genesis and multi-author blogs! :)

    Reply
  11. Keith Davis says:
    Dec 10, 2009 at 5:45 pm

    Useful tip.
    When I read post comments, I tend to read the author’s comments on the assumption that what he says carries more authority.
    I’m OK with the CSS but never sure about the php.
    You may have enticed me to start messing with the php!

    Reply
  12. joyoge bookmark says:
    Sep 5, 2009 at 8:00 pm

    nice tutorial, thank you

    Reply
  13. janghuan says:
    Sep 4, 2009 at 8:40 am

    In my wordpress version,I just need to add a exist class that the wordpress generates.It’s “comment-author-admin”.Maybe the class “bypostauthor” that wordpress generates also does work.

    Reply
  14. Blake Imeson says:
    Sep 4, 2009 at 12:42 am

    This method would fail for multi-author blogs right?

    Reply
    • Editorial Staff says:
      Sep 4, 2009 at 4:53 am

      You can probably add a comma and add more user IDs, but it will show all editor’s comment in highlighted version, so yes it will be a fail if you look at it that way.

      Reply

Leave a Reply Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

Over 1,320,000+ Readers

Get fresh content from WPBeginner

Featured WordPress Plugin
TrustPulse
TrustPulse
Instantly get 15% more conversions with social proof. Learn More »
How to Start a Blog How to Start a Blog
I need help with ...
Starting a
Blog
WordPress
Performance
WordPress
Security
WordPress
SEO
WordPress
Errors
Building an
Online Store
Useful WordPress Guides
    • 7 Best WordPress Backup Plugins Compared (Pros and Cons)
    • How to Fix the Error Establishing a Database Connection in WordPress
    • Why You Need a CDN for your WordPress Blog? [Infographic]
    • 30 Legit Ways to Make Money Online Blogging with WordPress
    • Self Hosted WordPress.org vs. Free WordPress.com [Infograph]
    • Free Recording: WordPress Workshop for Beginners
    • 24 Must Have WordPress Plugins for Business Websites
    • How to Properly Move Your Blog from WordPress.com to WordPress.org
    • 5 Best Contact Form Plugins for WordPress Compared
    • Which is the Best WordPress Popup Plugin? (Comparison)
    • Best WooCommerce Hosting in 2020 (Comparison)
    • How to Fix the Internal Server Error in WordPress
    • How to Install WordPress - Complete WordPress Installation Tutorial
    • Why You Should Start Building an Email List Right Away
    • How to Properly Move WordPress to a New Domain Without Losing SEO
    • How to Choose the Best WordPress Hosting for Your Website
    • How to Choose the Best Blogging Platform (Comparison)
    • WordPress Tutorials - 200+ Step by Step WordPress Tutorials
    • 5 Best WordPress Ecommerce Plugins Compared
    • 5 Best WordPress Membership Plugins (Compared)
    • 7 Best Email Marketing Services for Small Business (2020)
    • How to Choose the Best Domain Registrar (Compared)
    • The Truth About Shared WordPress Web Hosting
    • When Do You Really Need Managed WordPress Hosting?
    • 5 Best Drag and Drop WordPress Page Builders Compared
    • How to Switch from Blogger to WordPress without Losing Google Rankings
    • How to Properly Switch From Wix to WordPress (Step by Step)
    • How to Properly Move from Weebly to WordPress (Step by Step)
    • Do You Really Need a VPS? Best WordPress VPS Hosting Compared
    • How to Properly Move from Squarespace to WordPress
    • How to Register a Domain Name (+ tip to get it for FREE)
    • HostGator Review - An Honest Look at Speed & Uptime (2020)
    • SiteGround Reviews from 4196 Users & Our Experts (2020)
    • Bluehost Review from Real Users + Performance Stats (2020)
    • How Much Does It Really Cost to Build a WordPress Website?
    • How to Create an Email Newsletter the RIGHT WAY (Step by Step)
    • Free Business Name Generator (A.I Powered)
    • How to Create a Free Business Email Address in 5 Minutes (Step by Step)
    • How to Install Google Analytics in WordPress for Beginners
    • How to Move WordPress to a New Host or Server With No Downtime
    • Why is WordPress Free? What are the Costs? What is the Catch?
    • How to Make a Website in 2020 – Step by Step Guide
Deals & Coupons (view all)
Smash Balloon Coupon
Smash Balloon Coupon
Get 50% off Smash Balloon's powerful social media feed plugins.
MemberPress
MemberPress Coupon
Get up to 50% OFF on MemberPress WordPress premium membership plugin.
Featured In
About WPBeginner®

WPBeginner is a free WordPress resource site for Beginners. WPBeginner was founded in July 2009 by Syed Balkhi. The main goal of this site is to provide quality tips, tricks, hacks, and other WordPress resources that allows WordPress beginners to improve their site(s).
Join our team: We are Hiring!

Site Links
  • About Us
  • Contact Us
  • FTC Disclosure
  • Privacy Policy
  • Terms of Service
  • Free Blog Setup
  • Free Business Tools
Our Sites
  • OptinMonster
  • MonsterInsights
  • WPForms
  • SeedProd
  • Nameboy
  • RafflePress
  • Smash Balloon

Copyright © 2009 - 2021 WPBeginner LLC. All Rights Reserved. WPBeginner® is a registered trademark.

Managed by Awesome Motive | WordPress hosting by SiteGround | WordPress CDN by MaxCDN | WordPress Security by Sucuri.