WordPress.org

Forums

comment_reply_link not working. (7 posts)

  1. alexstudio
    Member
    Posted 5 years ago #

    All my plugins are turned off. I have threaded discussion turned on, comment-reply.js is loaded, and I have comment_reply_link right under the comment_text method. But the reply button does not appear.

    If I switch out my comments.php for the default theme's comments.php the reply button shows up, but it is just using the wp_list_comments() and this does not work for me; I could like to style the comments differently then wordpress has them arranged by default.

    Please someone help.

    my comments.php:

    [Code moderated as per the Forum Rules. Please use the pastebin]

  2. esmi
    Forum Moderator
    Posted 5 years ago #

  3. alexstudio
    Member
    Posted 5 years ago #

    the example that shows is using the wp_list_comments()...

    I tried using ` <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
    ` but this throws and error because (I think) $args is defined somewhere in the wp_list_comments and I'm not using that.

  4. fwoan
    Member
    Posted 5 years ago #

    I'm having the same issue. Anyone make any progress on this?

  5. fwoan
    Member
    Posted 5 years ago #

  6. fdblog01
    Member
    Posted 4 years ago #

    This is how I did it. The whole thing:

    In header.php just before calling wp_head:
    <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>

    In single.php where by default:
    <?php comments_template(); ?>
    Change to:
    <?php comments_template('', true);?>

    In comments.php where:
    <?php wp_list_comments(); ?>
    Change to:
    <?php wp_list_comments('type=comment&callback=my_custom_comments'); ?>

    In functions.php define your function for comments ("my_custom_comments" in this example). And inside the function:

    <div class="reply">
         <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
    </div>

    You can see an example of the function going to the page linked by fwoan & esmi on the comments below.

    With this, the Reply link worked for me, but for the whole threaded comments thing you need to place some other bits as well in comments.php. You can find more info on: .

    Hope it helps someone :)

  7. fdblog01
    Member
    Posted 4 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic