• Hi, I’m new to plugin development, but I’ve been looking quite enough for an answer to my question, and can’t seem to find it.
    The question is: how can I add a custom class, or maybe a wrapper with a class, to every comment that meets a certain condition, i. e. has a a certain meta key that my plugin assigns.
    For example, lets say I want to add a class to every comment with the word “tree”. When the comment is inserted into the database, I check for the word “tree”, and if present, I add a meta key and value to to that comment (for example, “tree” => “true”). Now I want to add the class “tree” to all those comments (for example, the class “green”), so I can display those comments with a green background, for example.
    I’ve been looking into comment_class(), get_comment_class() and other options, but nothing seems to fit.
    Hope I’m clear enough. Thanks in advance!

  • The topic ‘How to add a class to comments that meet certain conditions’ is closed to new replies.