1

On the same page, I have 3 comment threads. Each comment has a meta that tells in which tread they have to be displayed in. At the end of each thread, I have a form to post a comment in this specific thread and it adds the right meta.

The problem is when I click the “Reply” link, it adds a form under the comment, but not the good form. It adds the first form that appears in the page, event if I reply a comment from the third thread. So the meta that is added with my new comment is not the good one…

To generate my 3 comment threads , I use the comment_form() function. This function generated a div with a lot of hmtl inside. This div has an id="respond". I need to change this id for each comment thread to be different. Right now, all 3 comment threads have the same "respond" id.

Than, thanks to the comment reply link() function, i'll be able to control which respond_id is taken by comment-reply.js...

So all I need is to change this "respond" id for each comment thread that is generated by the comment_form() function ! But how :( ???

Thanks !

  • I don't see any filter to change this, so i think the easiest solution is to wrap your comment_form() function in a div with a specific id. <div id="respond-1"><?php comment_form(); ?></div> – passatgt May 12 '14 at 11:04
  • So from what I understand, you want three versions of comment_form() except each with their own IDs? You can add IDs to each form with id_form if that's what you're looking for: codex.wordpress.org/Function_Reference/comment_form Perhaps clarifying your question a bit might help to get a clearer answer or showing us what's being output that you're not liking in the code. – RachieVee May 13 '14 at 1:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.