WordPress.org

Ready to get started?Download WordPress

Forums

Author Comment Highlighting (6 posts)

  1. Gemfruit
    Member
    Posted 7 months ago #

    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?

  2. WPyogi
    Volunteer Moderator
    Posted 7 months ago #

    Would need to see the site.

  3. Gemfruit
    Member
    Posted 7 months ago #

    Site - http://atlas.arcknight.com/maps/dungeon/dungeon-rooms-cross-dungeon-rooms-bend

    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.

  4. WPyogi
    Volunteer Moderator
    Posted 7 months ago #

    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.

  5. Gemfruit
    Member
    Posted 7 months ago #

    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.

  6. Gemfruit
    Member
    Posted 7 months ago #

    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.

Reply

You must log in to post.

About this Topic