Ask your WordPress questions! Pay money and get answers fast! (more info)

Multiple comment reply forms - One for each comment WordPress

  • REFUNDED

I am trying to change the commenting system on my WordPress site to do the following...

- Display main leave a reply box above comment list
- Display 'Leave a reply' link underneath each existing comment
- Open comment form underneath select comment when 'Leave a reply' is clicked
- Leave main top leave a reply box in place

Currently when you click on the 'Leave a reply' link the main comment box disappears from its place at the top and is jquery'd into place underneath the comment you are replying to. I want this behavior to stop and work as I have detailed above.

I am currently creating a reply box underneath each comment as it is echo'd out in the loop. This works but when you try and input a reply and click submit on any comment apart from the original top main box it gives the error...

ERROR: please type a comment.

Please can someone help?

Answers (1)

2013-04-13

Daniel Yoen answers:

link or image please :-)


macster448 comments:

I don't have a link as it is hosted locally currently, what I do have however is the code I am currently using...

<div id="respond">
<form action="<?php echo site_url( '/wp-comments-post.php' ); ?>" method="post" id="<?php echo esc_attr( $args['id_form'] ); ?>">
<?php do_action( 'comment_form_top' ); ?>
<?php echo apply_filters( 'comment_form_logged_in', $args['logged_in_as'], $commenter, $user_identity ); ?>
<?php do_action( 'comment_form_logged_in_after', $commenter, $user_identity ); ?>
<?php else : ?>
<?php echo $args['comment_notes_before']; ?>
<?php
do_action( 'comment_form_before_fields' );
foreach ( (array) $args['fields'] as $name => $field ) {
echo apply_filters( "comment_form_field_{$name}", $field ) . "\n";
}
do_action( 'comment_form_after_fields' );
?>
<?php echo apply_filters( 'comment_form_field_comment', $args['comment_field'] ); ?>
<?php echo $args['comment_notes_after']; ?>
<p class="form-submit">
<input name="submit" class="btn commentsubmitbutton" type="submit" id="<?php echo esc_attr( $args['id_submit'] ); ?>" value="<?php echo esc_attr( $args['label_submit'] ); ?>" />
<?php comment_id_fields( $post_id ); ?>
</p>
<?php do_action( 'comment_form', $post_id ); ?>
</form>
</div>


I have inserted this code underneath each of the individual comments on the page, but attempting to submit any of these forms results in the error message...

ERROR: please type a comment.


Daniel Yoen comments:

First, try to disable threaded comment by uncheck "Enable threaded (nested) comments" in /wp-admin/options-discussion.php


macster448 comments:

Ok I have disabled them, same thing happens apart from the fact that I no longer have threaded comments. Just to confirm I do actually want threaded comments.


macster448 comments:

The other angle I was going to attempt to go with this was to de-register the WP version of comment-reply.js and register my custom version instead.

Inside this custom version it would make a copy of the box or something similar instead of moving the existing one down? Better idea?