Is there a way to have a hidden field or something in order to place the comment form in a template and have the comments be in reply to a specific comment (so that they would be nested)?

I am going to have an overlay on a page that allows people to comment on a specific comment. So I want to be able to tell the comment form that gets displayed in the overlay which comment the form is in response to.

Is that possible?


Yes, it is possible.You can integrate a custom template for comment detail page where users will start thread on particular comment.

You can create a URL using add_rewrite_rule. also add query vars for URL. Here you can get that query var and use template_redirect hook to to include a template by apply condition for that query var.

| improve this answer | |

Use this get_comments( $args );. You may catch by ID or name.

| improve this answer | |
  • I'm not sure how get_comments() allows you to reply, could you edit your answer and elaborate? – Howdy_McGee Feb 14 '17 at 19:04
  • <?php $args = array( 'author_email' => '', 'author_url' => '', 'ID' => '', 'post_id' => 0, 'post_author' => '', 'post_name' => '', 'post_status' => '', 'post_type' => '', ); // The Query $comments_query = new WP_Comment_Query; $comments = $comments_query->query( $args ); // Comment Loop if ( $comments ) { foreach ( $comments as $comment ) { echo '<p>' . $comment->comment_content . '</p>'; } } else { echo 'No comments found.'; } ?> – Wordpress Student Feb 14 '17 at 19:11
  • 1
    Thanks for your reply! Please use the edit link above, on your answer, to add in this information in a formatted manner. The comment section makes the code and explanation difficult to read. – Howdy_McGee Feb 14 '17 at 19:12

Your Answer

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

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