WordPress.org

Ready to get started?Download WordPress

Forums

comment_reply_link() generates no output? (13 posts)

  1. SteelFrog
    Member
    Posted 4 years ago #

    Hey guys,
    I'm trying to build my comment section and calling the comment_reply_link function to generate a 'Reply' link.

    However, I'm getting no output. The comment-reply.js loads up properly and the comments appear, but no link is found and nothing is echoed where the function was placed. I have threaded comments enabled in the "Discussion" options. Did I miss anything?

    I'm using:
    <li class="reply"><?php comment_reply_link(); ?></li>

  2. Jeremy Clark
    Moderator
    Posted 4 years ago #

    Have you added this to your comment form.
    <?php comment_id_fields(); ?>
    This is needed for the reply link to now where to move the form up to. Also make sure that your comment reply depth is set to more than 1 in the discussion options.

  3. SteelFrog
    Member
    Posted 4 years ago #

    Had to double-check that one, but yes, it's in there.

  4. esmi
    Theme Diva & Forum Moderator
    Posted 4 years ago #

    Check that you've used <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?> just before wp_head(); ?> in your theme's header.php file.

  5. SteelFrog
    Member
    Posted 4 years ago #

    Yup. The JavaScript call is there and it loads. Maybe it's something I've omitted in my comments callback? Here's the code.

    function steelfrog_comments($comment, $args, $depth) {
    			$GLOBALS['comment'] = $comment; ?>
    
    			<li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
    
    				<div class="comment_info">	
    
    					<div class="gravatar">
    						<?php echo get_avatar($comment,$size='50',$default='<path_to_url>' ); ?>
    					</div>
    
    					<div class="comment_poster">
    						<h5><?php comment_author_link(); ?></h5>
    						<span><?php printf(__('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?></span>
    					</div>
    
    					<div class="comment_options">
    						<ul class="options">
    							<li class="reply"><?php comment_reply_link(); ?></li>
    							<li class="quote"><a href="#" title="Quote and reply this comment"><span>Quote this comment</span></a></li>
    							<li class="link"><a href="#" title="Link to this comment"><span>Link to this comment</span></a></li>
    							<li class="website"><a href="#" title="Website of commenter"><span>Website of commenter</span></a></li>
    							<li class="edit"><a href="<?php echo get_edit_comment_link() ?>" title="Edit this comment"><span>Edit this comment</span></a></li>
    							<li class="close"><a href="#" title="Toggle this comment"><span>Toggle this comment</span></a></li>
    						</ul>
    					</div>
    				</div>
    
    				<div class="comment_content">
    					<?php comment_text() ?>
    				</div>
    			<?php }

    [EDIT] Running echo get_comment_reply_link() gets me no output either.

  6. SteelFrog
    Member
    Posted 4 years ago #

    Any other piece of code needed to help me figure out what I'm doing wrong here? I really don't see what it could be.

  7. Jeremy Clark
    Moderator
    Posted 4 years ago #

    The code should be.
    <?php echo comment_reply_link(array('depth' => $depth, 'max_depth' => $args['max_depth'])); ?>

  8. kcssm
    Member
    Posted 4 years ago #

    I am having the same problem.<?php echo comment_reply_link(array('depth' => $depth, 'max_depth' => $args['max_depth'])); ?> this code shows nothing. No link appears for "Reply". Searched through the net but could not find the solution. Any help is appreciated.

  9. fwoan
    Member
    Posted 4 years ago #

    I'm also having the same problem as SteelFrog and kcssm. The code provided by jeremyclark13 provides no output and I simply have an empty <p></p> where I have in my template:<p><?php echo comment_reply_link(array('depth' => $depth, 'max_depth' => $args['max_depth'])); ?></p>

    Any other ideas?

  10. fwoan
    Member
    Posted 4 years ago #

  11. hvtuananh
    Member
    Posted 3 years ago #

    This function generates no output in page but works fine in post.
    Any clue?

  12. php4ever
    Member
    Posted 3 years ago #

    try to enable the setting first in your admin panel.

    #1 reason it does not work, you need to enable;

    Enable threaded (nested) comments XX levels deep

  13. yashmistrey
    Member
    Posted 3 years ago #

    how to add class="simplemodal-login" in this code
    <?php echo comment_reply_link(array('depth' => $depth, 'max_depth' => $args['max_depth'])); ?>

    i want to add simple model plugin class in comment reply link !

Topic Closed

This topic has been closed to new replies.

About this Topic