0

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?

2 Answers 2

0

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.

-2

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

3
  • I'm not sure how get_comments() allows you to reply, could you edit your answer and elaborate?
    – Howdy_McGee
    Feb 14, 2017 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.'; } ?> Feb 14, 2017 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, 2017 at 19:12

Your Answer

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

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