I'm using the comment-reply script to move the comment form under thread when replying to a specific comment. Comment form is being displayed in theme with:

<?php comment_form(); ?>

The comment form output:

<div id="respond" class="comment-respond">

I'd like to add a class to the div ONLY when it's a reply and not a new comment. So, on reply click it would change to:

<div id="respond" class="comment-respond reply-to-comment">

Right now when the reply button is clicked and the form moves under the comment I'm not seeing any code changing at all.

1 Answer 1


You'd probably have to do this in javascript, but I'm guessing the reason you want to add a class is to style it differently?

If so, just use different styles for #respond that is inside a reply container. So perhaps the style would be .comment-replies > #respond or something similar.

  • There's no way to do it with css in my theme because when you click the reply button the form moves but nothing in the source code actually changes. BUT, now I'm looking at my custom comment function because I'm guessing that's the issue - and one I'm more familiar with than javascript. So thanks!
    – Amanda
    Commented Sep 28, 2014 at 14:52
  • Oh dear, you were totally right. This is why I shouldn't ask questions on here when I'm half asleep! :)
    – Amanda
    Commented Sep 28, 2014 at 15:16
  • No worries! Sometimes it will look like the source code does not change bc 'View Source' doesn't update in Chrome.
    – jetlej
    Commented Sep 28, 2014 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.