Highlight Post Author Comments in WordPress

[ad_1]

You might have noticed on many websites that they highlight their author’s comment by making it a different background color and style. Highlighting post author comments is useful, if you receive a large number of comments on your website and you want your visitors to easily identify post author’s responses in the comment list. This is particularly very useful in support or question/answer posts where your customers or clients may specifically be looking for the author’s responses. So in this article, we will show you the easiest and simplest way to highlight post author comments in WordPress.

In past WordPress developers used to match commenter’s email address with blog post author’s email to highlight post author comments but this method was flawed because if a commenter knows the email address of the blog author, he could use the blog post author’s email address in his comment and get his own comment highlighted. Later WordPress provided a pretty easy solution for this problem. WordPress by default started adding a number of CSS classes to each comment which makes it easier for designers and developers to style comments accordingly. Among those default classes that WordPress has added, “.bypostauthor” class is specifically targeted for styling post author’s comments.

Now all you have to do is to add your custom styles for .bypostauthor class in your style.css file to highlight post author comments.

/* highlight post author comments */
.commentlist .bypostauthor, .commentlist li ul.children li.bypostauthor {
    background: #FFC;
    color: #C30;
}
.commentlist .bypostauthor a, .commentlist li ul.children li.bypostauthor a {
    color: #C30;
}

This snippet will highlight post author comments and now your post author comments will look like this.

Highlight Post Author Comments

Of course you should use your own CSS styles better suited for your website’s color scheme.

[ad_2]

Leave a Reply

Random Post Selection ::

Recent Posts

Unlock Unlimited Downloads