WordPress.org

Support

Support » How-To and Troubleshooting » comment_reply_link() generates no output?

comment_reply_link() generates no output?

  • 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>

Viewing 12 replies - 1 through 12 (of 12 total)
  • Jeremy Clark

    @jeremyclark13

    Member

    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.

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

    esmi

    @esmi

    Forum Moderator

    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.

    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.

    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.

    Jeremy Clark

    @jeremyclark13

    Member

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

    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.

    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?

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

    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

    yashmistrey

    @yashmistrey

    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 !

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘comment_reply_link() generates no output?’ is closed to new replies.
Skip to toolbar