WordPress.org

Ready to get started?Download WordPress

Forums

comment_reply_link not moving my form? (3 posts)

  1. Twansparant
    Member
    Posted 3 years ago #

    Hi there,

    I'm having a problem with the moveForm function triggered when replying on an excisting comment. I just can't seem to get it working, the respond div just won't move under the comment I'm replying on.

    Everything seems to be in order:
    In my header I call the comment-reply javascript just before wp_head:

    if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
            // enqueue the javascript that performs in-link comment reply fanciness
            wp_enqueue_script( 'comment-reply' );
        }
    wp_head();

    Which does get loaded correctly like this:

    <script type='text/javascript' src='http://www.mydomain.com/wordpress/wp-includes/js/comment-reply.js?ver=20090102'></script>

    To be sure the problem isn't in my comments.php file I removed the callback function and put wp_list_comments(); before comment_form(); but that didn't change anything...

    In the comment form the Reply link is added like this:

    <?php comment_reply_link( array_merge( $args, array( 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>

    The output of the Reply links seems to be correct:

    <a  class="comment-reply-link" href="/wordpress/feature/postname?replytocom=51#respond" onclick="return addComment.moveForm("div-comment-51", "51", "respond", "1878")">Reply</a>

    However the div- is missing in the comments list id's, they're supposed to be comment-51. So when I change my callback back to twentyten:

    wp_list_comments( array( 'callback' => 'twentyten_comment' ) );

    The output of the reply links become correct like this:

    <a  class="comment-reply-link" href="/wordpress/feature/postname?replytocom=51#respond" onclick="return addComment.moveForm("comment-51", "51", "respond", "1878")">Reply</a>

    But the form is still not moving, instead the reply-title in the allready excisting respond form changes and the cancel reply link show up...

    Tips anyone? Thanks for your help!
    Cheers, Toine

  2. digitalrenewal
    Member
    Posted 2 years ago #

    Im having this exact same problem. Anyone know the answer????

  3. Thomas Jaggi
    Member
    Posted 2 years ago #

    Adding the comment's ID as a second argument to "(get_)comment_reply_link" fixed the issue in my case:
    $reply = get_comment_reply_link(array_merge($args, array('depth' => $depth, 'max_depth' => $args['max_depth'])), $comment->comment_ID);

Topic Closed

This topic has been closed to new replies.

About this Topic