Highlight author comments in Wordpress - gHacks Tech News

Highlight author comments in WordPress

Most WordPress themes iterate between two different comment background colors but do not highlight author or user comments in other ways.  It may make sense to highlight author comments in the comment section of the blog to make it easier to distinguish between reader and author comments. This not only highlights "official" answers in the comment section, as it is also a way to prevent impersonation attempts on the blog.

You may have noticed that you are free to select any name you want when commenting, including the name of the author of the blog post. WordPress does not reserve registered names to prevent this from happening. While careful comment moderation can prevent that from happening, it is still beneficial to highlight author comments in WordPress.

wordpress author comments

WordPress webmasters have several options at their disposal to add author comments. Probably the easiest way to do just that is to install a WordPress plugin. While that may be the easiest way, it is not really something that I'd recommend to use as there are better alternatives available. You will also find third party solutions scattered around on the web that instruct you to add a new CSS style to your code and the style sheet. Those are out of date as well, as there is an even better option available.

The developers have added an author comment style to WordPress 2.7 and newer that you can use to highlight author comments. What you need to do is add a single line to the end of your style sheet to add it to your WordPress blog.

.bypostauthor { background-color:#ccc !important; }

Background-color determines the color used to highlight post author comments. I suggest you take a look at this site for inspiration as it lists 500 color codes for you to use.

You may need to clear the cache if you are using a caching plugin before the changes become visible on the website. If they still do not appear, try forcefully reloading the page with Ctrl-F5.

We need your help

Advertising revenue is falling fast across the Internet, and independently-run sites like Ghacks are hit hardest by it. The advertising model in its current form is coming to an end, and we have to find other ways to continue operating this site.

We are committed to keeping our content free and independent, which means no paywalls, no sponsored posts, no annoying ad formats or subscription fees.

If you like our content, and would like to help, please consider making a contribution:

Comments

  1. Anonymous said on September 28, 2012 at 3:26 pm
    Reply

    Formula One too.

  2. shasha said on October 30, 2012 at 7:55 am
    Reply

    Useful information,Martin

  3. Nadeem Khan said on June 29, 2013 at 12:43 pm
    Reply

    It wont work for multi author blogs, right ?

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

Please note that your comment may not appear immediately after you post it.