WordPress.org

Ready to get started?Download WordPress

Forums

comment-reply script not working on custom comment output (2 posts)

  1. marianograndioso
    Member
    Posted 1 year ago #

    I'm using a callback function to output the comments on my site, but I'm having problems with the reply script. I always get a full page reload.

    I'm calling the script in the same place as all my other scripts like this:
    if ( is_singular() ) wp_enqueue_script( 'comment-reply' );
    The script is loaded correctly.

    I'm listing my comments like this:

    $a_args = array(
    	'type' => 'comment',
    	'callback' => 'custom_comments',
    );
    wp_list_comments( $a_args );

    Here's the code that generates the reply link:

    $a_args = array(
    	'depth' => $depth,
    	'max_depth' => $args['max_depth'],
    	'before' => '<div class="reply">',
    	'after' => '</div>',
    );
    $s_reply_link = comment_reply_link(array_merge( $args, $a_args ));
    echo $s_reply_link;

    Haven't customized the comment form yet, I just call it like this:
    <?php comment_form(); ?>

    The script works when I call the wp_list_comments function without the callback. The output inside the '.reply' div is the same in both cases.

    [ Please do not bump, that's not permitted here. ]

  2. marianograndioso
    Member
    Posted 1 year ago #

    Hey guys.
    If anyone would check out the code ( here ) and help me with this, it would be greatly appreciated.
    Don't worry about the content and the ugly contact form for anonymous users. I need to make the 'reply to' script work.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags