Support » Fixing WordPress » Author Comment Highlighting

  • I’m using the following to highlight comments made by the author.

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

    It works, but all replies to that author comment also get highlighted, which is an undesired effect. I’ve looked everywhere for a solution to this, but everything I find still has this issue. Anyone have any idea how to highlight author comments, but not replies to the author comments?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Would need to see the site.

    Site –

    The addition is completely site / theme independent, so seeing the site won’t help you beyond seeing how the code works on any site. The issue is that replies are child posts of the highlighted posts, and seem to inherit the highlighting functionality, which is not desired, as I want only posts from the author to be highlighted.

    Adding this gets fairly close:

    .bypostauthor .children {
        background-color: #FFFFFF;
        margin-left: 0;
        padding-left: 20px;

    BTW, I’d suggest using a child theme or custom CSS so your changes are not lost when WP is updated.

    In the above solution, won’t that break the following scenario?

    Author post
    non-author reply
    Author reply

    Wouldn’t that make the author replay at the end not highlighted? There isn’t a more elegant solution to simply see if a particular instance is the author, and highlight that, and only that? It seems extremely silly that WordPress would support this functionality by default, but have it be so sub-par.

    As for the child theme bit, I’m aware it needs to be done, and will look into them shortly. I simply back up my files for now, but yeah, child themes are a must.

    It appears as though it actually works, and doesn’t do what I thought it would. It’s still not a perfectly elegant solution, as you need to match the child css to whatever happens naturally, but it’s damn close. Thanks for help with the solution.

    I’ll leave this post open in case someone has a better solution – if one isn’t found soon, we can mark it as resolved.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Author Comment Highlighting’ is closed to new replies.