试图编辑海明威wordpress主题以添加;评论回复「;链接

试图编辑海明威wordpress主题以添加;评论回复「;链接,wordpress,wordpress-theming,Wordpress,Wordpress Theming,我试图通过添加comment\u reply\u link() 下面是我的代码 <?php if ($comments) : ?> <ol id="comments" class="commentlist"> <?php foreach ($comments as $comment) : ?> <li id="comment-<?php comment_ID() ?>"> &l

我试图通过添加
comment\u reply\u link()

下面是我的代码

<?php if ($comments) : ?>

    <ol id="comments" class="commentlist">

    <?php foreach ($comments as $comment) : ?>
        <li id="comment-<?php comment_ID() ?>">
            <cite>
                        <span class="avatarspan"><?php echo get_avatar( $comment, 32 ); ?></span>
                <span class="author"><?php comment_author_link() ?></span>
                <span class="date"><?php comment_date('d/m/y') ?> / <?php comment_date('ga') ?></span>
            </cite>
            <div class="content">
                <?php if ($comment->comment_approved == '0') : ?>
                <em>Your comment is awaiting moderation.</em>
                <?php endif; ?>
                <?php comment_text() ?>
                <br><?php comment_reply_link(); ?>
            </div>
            <div class="clear"></div>
        </li>


    <?php /* Changes every other comment to a different class */    
        if ('alt' == $oddcomment) $oddcomment = '';
        else $oddcomment = 'alt';
    ?>

    <?php endforeach; /* end for each comment */ ?>

    </ol>


您的代码看起来不错,但我认为它缺少$args(特别是注释深度的值)参数

// get max_depth from options
$max_depth = get_option('thread_comments_depth');

// check it has sensible value
if (!$max_depth)
    $max_depth = 1;

?php comment_reply_link($args = array(
    'depth'      => 1,
    'max_depth'  => $max_depth
    ) 
   ); ?>

您的代码看起来不错,但我认为它缺少$args(特别是注释深度的值)参数

// get max_depth from options
$max_depth = get_option('thread_comments_depth');

// check it has sensible value
if (!$max_depth)
    $max_depth = 1;

?php comment_reply_link($args = array(
    'depth'      => 1,
    'max_depth'  => $max_depth
    ) 
   ); ?>

您的代码在哪个模板中?您可能修改了错误的模板。我正在编辑comments.php文件您的代码在哪个模板中?您可能修改了错误的模板。我正在编辑comments.php文件