Wordpress 评论(回复)链接不';不显示

Wordpress 评论(回复)链接不';不显示,wordpress,Wordpress,我想为注释创建自己的模板,所以我运行了foreach,结果如下: <dl class="commentlist"> <?php foreach ($comments as $comment) : ?> <dt><?php printf(__('%s'), get_comment_author_link()) ?> <em><?php echo human_time_diff( get_comment_tim

我想为注释创建自己的模板,所以我运行了
foreach
,结果如下:

<dl class="commentlist">
    <?php foreach ($comments as $comment) : ?>
        <dt><?php printf(__('%s'), get_comment_author_link()) ?> <em><?php echo human_time_diff( get_comment_time('U'), current_time('timestamp') ); ?> <?php echo get_locale() == 'pl_PL' ? 'temu' : 'ago'; ?></em></dt>
        <dd>
            <?php if ($comment->comment_approved == '0') : ?>
                <em>Komentarz czeka na zatwierdzenie</em><br />
            <?php endif; ?>

            <?php comment_text(); ?>
            <?php comment_reply_link( array ( 'reply_text' => 'Reply this comment' ) ); ?>
        </dd>
    <?php endforeach; ?>
</dl>
给我一些数字(可能是注释的时间戳)


我能做什么?

好的,这将是一个很长的答案:)

1.创建一个commnets.php并添加以下代码:

<?php if ( post_password_required() ): ?>   
<p class="nopassword"><?php _e( 'This post is password protected. Enter the password to view and post comments.' , 'override' ); ?></p>  

 <?php   
 return;  
 endif;  
 ?>  
    <?php if(!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME'])) : ?>
    <?php die('The comments template cannot be accessed outside of an entry. Nice try!'); ?>
    <?php endif; ?>
    <?php
    $required_text='';
    $aria_req='';
    ?>
    <?php $args = array(
'id_form' => 'commentform',
'id_submit' => 'submit',
'title_reply' => __( 'Leave a Reply' ),
'title_reply_to' => __( 'Leave a Reply to %s' ),
'cancel_reply_link' => __( 'Cancel Reply' ),
'label_submit' => __( 'Post Comment' ),
'comment_field' => '<br/><p class="comment-form-comment"><label for="comment">' . _x( 'Comment post', 'noun' ) . '</label><br/><textarea id="comment" name="comment" cols="45" rows="8"></textarea></p>',//Removed from textarea aria-required="true" HTML5 fix
'must_log_in' => '<p class="must-log-in">' .  sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( ) ) ) ) . '</p>',
'logged_in_as' => '<p class="logged-in-as">' . sprintf( __( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>' ), admin_url( 'profile.php' ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( ) ) ) ) . '</p>',
'comment_notes_before' => '<p class="comment-notes">' . __( 'Your email address will not be published.' ) . ( $req ? $required_text : '' ) . '</p>',
'comment_notes_after' => '<p class="form-allowed-tags">' . sprintf( __( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s' ), '<br/><code>' . allowed_tags() . '</code>' ) . '</p>',
'fields' => apply_filters( 'comment_form_default_fields', array(
'author' => '<div class="commnet_text_wrapper"><p class="comment-form-author">' . '<label for="author">' . __( 'Name', 'override' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '<input class="author" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>',
'email' => '<p class="comment-form-email"><label for="email">' . __( 'Email', 'override' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '<input class="email" id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>',
'url' => '<p class="comment-form-url"><label for="url">' . __( 'Website', 'override' ) . '</label>' . '<input id="url" class="website" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p></div>' ) ) );

 ?>

     <?php comment_form($args); ?>
     <ol class="commentlist">
     <?php wp_list_comments('type=comment&callback=mytheme_comment'); ?>
       </ol>
      <div class="paginate-com">
      <?php paginate_comments_links(
      array('prev_text' => __('&lsaquo; Previous comment','override'), 'next_text' => __('Next commnet &rsaquo;','override'))
      ); ?>
     </div>
      // Enable CUSTOM "REPLY" COMMENT FORM so we can style it
      function mytheme_comment($comment, $args, $depth) {
    $GLOBALS['comment'] = $comment;
    extract($args, EXTR_SKIP);

    if ( 'div' == $args['style'] ) {
        $tag = 'div';
        $add_below = 'comment';
    } else {
        $tag = 'li';
        $add_below = 'div-comment';
    }
            ?>
    <<?php echo $tag ?> <?php comment_class(empty( $args['has_children'] ) ? '' : 'parent') ?> id="comment-<?php comment_ID() ?>">
    <?php if ( 'div' != $args['style'] ) : ?>
    <div id="div-comment-<?php comment_ID() ?>" class="comment-body">
    <?php endif; ?>
    <div class="comment-author vcard">
    <?php if ($args['avatar_size'] != 0) echo get_avatar( $comment, $args['avatar_size'] ); ?>
    <br/><?php printf(__('<span class="saywrap"><span class="fn">%s</span> <span class="says">says:</span></span>','override'), get_comment_author_link()) ?>
    </div>
            <?php if ($comment->comment_approved == '0') : ?>
    <em class="comment-awaiting-moderation"><?php _e('Your comment is awaiting moderation.') ?></em>
    <br />
           <?php endif; ?>



    <?php comment_text() ?>
            <div class="comment-meta commentmetadata"><a class="commentlink" href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
        <?php
            /* translators: 1: date, 2: time */
            printf( __('%1$s at %2$s','override'), get_comment_date(),  get_comment_time()) ?></a><?php edit_comment_link(__('(Edit)','override'),'  ','' );
        ?>
    </div>
    <div class="reply">
    <?php comment_reply_link(array_merge( $args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
    </div>
    <?php if ( 'div' != $args['style'] ) : ?>
    </div>
    <?php endif; ?>
            <?php
            }
将该文件上载到主题根目录(theme index.php所在的位置)

2.打开functions.php并添加以下代码:

<?php if ( post_password_required() ): ?>   
<p class="nopassword"><?php _e( 'This post is password protected. Enter the password to view and post comments.' , 'override' ); ?></p>  

 <?php   
 return;  
 endif;  
 ?>  
    <?php if(!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME'])) : ?>
    <?php die('The comments template cannot be accessed outside of an entry. Nice try!'); ?>
    <?php endif; ?>
    <?php
    $required_text='';
    $aria_req='';
    ?>
    <?php $args = array(
'id_form' => 'commentform',
'id_submit' => 'submit',
'title_reply' => __( 'Leave a Reply' ),
'title_reply_to' => __( 'Leave a Reply to %s' ),
'cancel_reply_link' => __( 'Cancel Reply' ),
'label_submit' => __( 'Post Comment' ),
'comment_field' => '<br/><p class="comment-form-comment"><label for="comment">' . _x( 'Comment post', 'noun' ) . '</label><br/><textarea id="comment" name="comment" cols="45" rows="8"></textarea></p>',//Removed from textarea aria-required="true" HTML5 fix
'must_log_in' => '<p class="must-log-in">' .  sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( ) ) ) ) . '</p>',
'logged_in_as' => '<p class="logged-in-as">' . sprintf( __( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>' ), admin_url( 'profile.php' ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( ) ) ) ) . '</p>',
'comment_notes_before' => '<p class="comment-notes">' . __( 'Your email address will not be published.' ) . ( $req ? $required_text : '' ) . '</p>',
'comment_notes_after' => '<p class="form-allowed-tags">' . sprintf( __( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s' ), '<br/><code>' . allowed_tags() . '</code>' ) . '</p>',
'fields' => apply_filters( 'comment_form_default_fields', array(
'author' => '<div class="commnet_text_wrapper"><p class="comment-form-author">' . '<label for="author">' . __( 'Name', 'override' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '<input class="author" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>',
'email' => '<p class="comment-form-email"><label for="email">' . __( 'Email', 'override' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '<input class="email" id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>',
'url' => '<p class="comment-form-url"><label for="url">' . __( 'Website', 'override' ) . '</label>' . '<input id="url" class="website" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p></div>' ) ) );

 ?>

     <?php comment_form($args); ?>
     <ol class="commentlist">
     <?php wp_list_comments('type=comment&callback=mytheme_comment'); ?>
       </ol>
      <div class="paginate-com">
      <?php paginate_comments_links(
      array('prev_text' => __('&lsaquo; Previous comment','override'), 'next_text' => __('Next commnet &rsaquo;','override'))
      ); ?>
     </div>
      // Enable CUSTOM "REPLY" COMMENT FORM so we can style it
      function mytheme_comment($comment, $args, $depth) {
    $GLOBALS['comment'] = $comment;
    extract($args, EXTR_SKIP);

    if ( 'div' == $args['style'] ) {
        $tag = 'div';
        $add_below = 'comment';
    } else {
        $tag = 'li';
        $add_below = 'div-comment';
    }
            ?>
    <<?php echo $tag ?> <?php comment_class(empty( $args['has_children'] ) ? '' : 'parent') ?> id="comment-<?php comment_ID() ?>">
    <?php if ( 'div' != $args['style'] ) : ?>
    <div id="div-comment-<?php comment_ID() ?>" class="comment-body">
    <?php endif; ?>
    <div class="comment-author vcard">
    <?php if ($args['avatar_size'] != 0) echo get_avatar( $comment, $args['avatar_size'] ); ?>
    <br/><?php printf(__('<span class="saywrap"><span class="fn">%s</span> <span class="says">says:</span></span>','override'), get_comment_author_link()) ?>
    </div>
            <?php if ($comment->comment_approved == '0') : ?>
    <em class="comment-awaiting-moderation"><?php _e('Your comment is awaiting moderation.') ?></em>
    <br />
           <?php endif; ?>



    <?php comment_text() ?>
            <div class="comment-meta commentmetadata"><a class="commentlink" href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
        <?php
            /* translators: 1: date, 2: time */
            printf( __('%1$s at %2$s','override'), get_comment_date(),  get_comment_time()) ?></a><?php edit_comment_link(__('(Edit)','override'),'  ','' );
        ?>
    </div>
    <div class="reply">
    <?php comment_reply_link(array_merge( $args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
    </div>
    <?php if ( 'div' != $args['style'] ) : ?>
    </div>
    <?php endif; ?>
            <?php
            }
//启用自定义“回复”注释表单,以便我们可以对其进行样式设置
函数mytheme_comment($comment、$args、$depth){
$GLOBALS['comment']=$comment;
提取($args,EXTR_SKIP);
如果('div'=$args['style'])){
$tag='div';
$add_below='comment';
}否则{
$tag='li';
$add_below='div comment';
}
?>
id=“comment-”>

好的,这将是一个很长的答案:)

1.创建一个commnets.php并添加以下代码:

<?php if ( post_password_required() ): ?>   
<p class="nopassword"><?php _e( 'This post is password protected. Enter the password to view and post comments.' , 'override' ); ?></p>  

 <?php   
 return;  
 endif;  
 ?>  
    <?php if(!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME'])) : ?>
    <?php die('The comments template cannot be accessed outside of an entry. Nice try!'); ?>
    <?php endif; ?>
    <?php
    $required_text='';
    $aria_req='';
    ?>
    <?php $args = array(
'id_form' => 'commentform',
'id_submit' => 'submit',
'title_reply' => __( 'Leave a Reply' ),
'title_reply_to' => __( 'Leave a Reply to %s' ),
'cancel_reply_link' => __( 'Cancel Reply' ),
'label_submit' => __( 'Post Comment' ),
'comment_field' => '<br/><p class="comment-form-comment"><label for="comment">' . _x( 'Comment post', 'noun' ) . '</label><br/><textarea id="comment" name="comment" cols="45" rows="8"></textarea></p>',//Removed from textarea aria-required="true" HTML5 fix
'must_log_in' => '<p class="must-log-in">' .  sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( ) ) ) ) . '</p>',
'logged_in_as' => '<p class="logged-in-as">' . sprintf( __( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>' ), admin_url( 'profile.php' ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( ) ) ) ) . '</p>',
'comment_notes_before' => '<p class="comment-notes">' . __( 'Your email address will not be published.' ) . ( $req ? $required_text : '' ) . '</p>',
'comment_notes_after' => '<p class="form-allowed-tags">' . sprintf( __( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s' ), '<br/><code>' . allowed_tags() . '</code>' ) . '</p>',
'fields' => apply_filters( 'comment_form_default_fields', array(
'author' => '<div class="commnet_text_wrapper"><p class="comment-form-author">' . '<label for="author">' . __( 'Name', 'override' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '<input class="author" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>',
'email' => '<p class="comment-form-email"><label for="email">' . __( 'Email', 'override' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '<input class="email" id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>',
'url' => '<p class="comment-form-url"><label for="url">' . __( 'Website', 'override' ) . '</label>' . '<input id="url" class="website" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p></div>' ) ) );

 ?>

     <?php comment_form($args); ?>
     <ol class="commentlist">
     <?php wp_list_comments('type=comment&callback=mytheme_comment'); ?>
       </ol>
      <div class="paginate-com">
      <?php paginate_comments_links(
      array('prev_text' => __('&lsaquo; Previous comment','override'), 'next_text' => __('Next commnet &rsaquo;','override'))
      ); ?>
     </div>
      // Enable CUSTOM "REPLY" COMMENT FORM so we can style it
      function mytheme_comment($comment, $args, $depth) {
    $GLOBALS['comment'] = $comment;
    extract($args, EXTR_SKIP);

    if ( 'div' == $args['style'] ) {
        $tag = 'div';
        $add_below = 'comment';
    } else {
        $tag = 'li';
        $add_below = 'div-comment';
    }
            ?>
    <<?php echo $tag ?> <?php comment_class(empty( $args['has_children'] ) ? '' : 'parent') ?> id="comment-<?php comment_ID() ?>">
    <?php if ( 'div' != $args['style'] ) : ?>
    <div id="div-comment-<?php comment_ID() ?>" class="comment-body">
    <?php endif; ?>
    <div class="comment-author vcard">
    <?php if ($args['avatar_size'] != 0) echo get_avatar( $comment, $args['avatar_size'] ); ?>
    <br/><?php printf(__('<span class="saywrap"><span class="fn">%s</span> <span class="says">says:</span></span>','override'), get_comment_author_link()) ?>
    </div>
            <?php if ($comment->comment_approved == '0') : ?>
    <em class="comment-awaiting-moderation"><?php _e('Your comment is awaiting moderation.') ?></em>
    <br />
           <?php endif; ?>



    <?php comment_text() ?>
            <div class="comment-meta commentmetadata"><a class="commentlink" href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
        <?php
            /* translators: 1: date, 2: time */
            printf( __('%1$s at %2$s','override'), get_comment_date(),  get_comment_time()) ?></a><?php edit_comment_link(__('(Edit)','override'),'  ','' );
        ?>
    </div>
    <div class="reply">
    <?php comment_reply_link(array_merge( $args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
    </div>
    <?php if ( 'div' != $args['style'] ) : ?>
    </div>
    <?php endif; ?>
            <?php
            }
将该文件上载到主题根目录(theme index.php所在的位置)

2.打开functions.php并添加以下代码:

<?php if ( post_password_required() ): ?>   
<p class="nopassword"><?php _e( 'This post is password protected. Enter the password to view and post comments.' , 'override' ); ?></p>  

 <?php   
 return;  
 endif;  
 ?>  
    <?php if(!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME'])) : ?>
    <?php die('The comments template cannot be accessed outside of an entry. Nice try!'); ?>
    <?php endif; ?>
    <?php
    $required_text='';
    $aria_req='';
    ?>
    <?php $args = array(
'id_form' => 'commentform',
'id_submit' => 'submit',
'title_reply' => __( 'Leave a Reply' ),
'title_reply_to' => __( 'Leave a Reply to %s' ),
'cancel_reply_link' => __( 'Cancel Reply' ),
'label_submit' => __( 'Post Comment' ),
'comment_field' => '<br/><p class="comment-form-comment"><label for="comment">' . _x( 'Comment post', 'noun' ) . '</label><br/><textarea id="comment" name="comment" cols="45" rows="8"></textarea></p>',//Removed from textarea aria-required="true" HTML5 fix
'must_log_in' => '<p class="must-log-in">' .  sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( ) ) ) ) . '</p>',
'logged_in_as' => '<p class="logged-in-as">' . sprintf( __( 'Logged in as <a href="%1$s">%2$s</a>. <a href="%3$s" title="Log out of this account">Log out?</a>' ), admin_url( 'profile.php' ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( ) ) ) ) . '</p>',
'comment_notes_before' => '<p class="comment-notes">' . __( 'Your email address will not be published.' ) . ( $req ? $required_text : '' ) . '</p>',
'comment_notes_after' => '<p class="form-allowed-tags">' . sprintf( __( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s' ), '<br/><code>' . allowed_tags() . '</code>' ) . '</p>',
'fields' => apply_filters( 'comment_form_default_fields', array(
'author' => '<div class="commnet_text_wrapper"><p class="comment-form-author">' . '<label for="author">' . __( 'Name', 'override' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '<input class="author" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>',
'email' => '<p class="comment-form-email"><label for="email">' . __( 'Email', 'override' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) . '<input class="email" id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>',
'url' => '<p class="comment-form-url"><label for="url">' . __( 'Website', 'override' ) . '</label>' . '<input id="url" class="website" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p></div>' ) ) );

 ?>

     <?php comment_form($args); ?>
     <ol class="commentlist">
     <?php wp_list_comments('type=comment&callback=mytheme_comment'); ?>
       </ol>
      <div class="paginate-com">
      <?php paginate_comments_links(
      array('prev_text' => __('&lsaquo; Previous comment','override'), 'next_text' => __('Next commnet &rsaquo;','override'))
      ); ?>
     </div>
      // Enable CUSTOM "REPLY" COMMENT FORM so we can style it
      function mytheme_comment($comment, $args, $depth) {
    $GLOBALS['comment'] = $comment;
    extract($args, EXTR_SKIP);

    if ( 'div' == $args['style'] ) {
        $tag = 'div';
        $add_below = 'comment';
    } else {
        $tag = 'li';
        $add_below = 'div-comment';
    }
            ?>
    <<?php echo $tag ?> <?php comment_class(empty( $args['has_children'] ) ? '' : 'parent') ?> id="comment-<?php comment_ID() ?>">
    <?php if ( 'div' != $args['style'] ) : ?>
    <div id="div-comment-<?php comment_ID() ?>" class="comment-body">
    <?php endif; ?>
    <div class="comment-author vcard">
    <?php if ($args['avatar_size'] != 0) echo get_avatar( $comment, $args['avatar_size'] ); ?>
    <br/><?php printf(__('<span class="saywrap"><span class="fn">%s</span> <span class="says">says:</span></span>','override'), get_comment_author_link()) ?>
    </div>
            <?php if ($comment->comment_approved == '0') : ?>
    <em class="comment-awaiting-moderation"><?php _e('Your comment is awaiting moderation.') ?></em>
    <br />
           <?php endif; ?>



    <?php comment_text() ?>
            <div class="comment-meta commentmetadata"><a class="commentlink" href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">
        <?php
            /* translators: 1: date, 2: time */
            printf( __('%1$s at %2$s','override'), get_comment_date(),  get_comment_time()) ?></a><?php edit_comment_link(__('(Edit)','override'),'  ','' );
        ?>
    </div>
    <div class="reply">
    <?php comment_reply_link(array_merge( $args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
    </div>
    <?php if ( 'div' != $args['style'] ) : ?>
    </div>
    <?php endif; ?>
            <?php
            }
//启用自定义“回复”注释表单,以便我们可以对其进行样式设置
函数mytheme_comment($comment、$args、$depth){
$GLOBALS['comment']=$comment;
提取($args,EXTR_SKIP);
如果('div'=$args['style'])){
$tag='div';
$add_below='comment';
}否则{
$tag='li';
$add_below='div comment';
}
?>
id=“comment-”>

如果您使用的不是
wp\u list\u comments
,而是例如
get\u comments
,然后像上面所做的那样为每个人运行一个,那么
comment\u reply\u链接的问题如下所示:

在wordpress comment-template.php中,由
comment\u reply\u link
使用的
get\u comment\u reply\u link
$args['max\u depth']
中有一个
NULL
值,因此下面的if语句:

function get_comment_reply_link($args = array(), $comment = null, $post = null) {

$defaults = array(
    'add_below'  => 'comment',
    'respond_id' => 'respond',
    'reply_text' => __('Reply'),
    'login_text' => __('Log in to Reply'),
    'depth'      => 0,
    'before'     => '',
    'after'      => ''
);

$args = wp_parse_args($args, $defaults);

if ( 0 == $args['depth'] || $args['max_depth'] <= $args['depth'] )
    return;

然后,该链接将显示。

如果您使用的不是
wp\u list\u comments
,而是例如
get\u comments
,然后像上面所做的那样为每个链接运行一个,那么
comment\u reply\u link
的问题如下:

在wordpress comment-template.php中,由
comment\u reply\u link
使用的
get\u comment\u reply\u link
$args['max\u depth']
中有一个
NULL
值,因此下面的if语句:

function get_comment_reply_link($args = array(), $comment = null, $post = null) {

$defaults = array(
    'add_below'  => 'comment',
    'respond_id' => 'respond',
    'reply_text' => __('Reply'),
    'login_text' => __('Log in to Reply'),
    'depth'      => 0,
    'before'     => '',
    'after'      => ''
);

$args = wp_parse_args($args, $defaults);

if ( 0 == $args['depth'] || $args['max_depth'] <= $args['depth'] )
    return;

然后链接将显示。

这是您正在寻找朋友的链接。这是您正在寻找朋友的链接。