简短回答:添加comments_template(); 在您的the_content().
但有一种更好的方法可以做到这一点,它可以继承你在主博客上的任何格式和风格。也许你不想这样,所以如果需要的话,忽略其余的。
下面是改进的循环代码:
$args = array( \'numberposts\' => -1);
$query = new WP_Query($args);
if ($query->have_posts()) {
    while ($query->have_posts()) {
        $query->the_post();
        get_template_part(\'content\', get_post_format());
    }
    wp_reset_postdata();
} else {
    get_template_part(\'content\', \'none\');
}
 这是一个非常基本的Wordpress循环,没有什么真正棘手的事情发生,您所提供的代码几乎就是这样。此代码不会直接输出内容,而是像中的循环一样加载模板部分
index.php, 其中应包括
comments_template() 如果这是一个半途而废的体面主题。
以下是更新后的改进循环,适用于没有content.php:
if ($query->have_posts()) {
    while ($query->have_posts()) {
        $query->the_post();
        the_content();
        comments_template();
    }
    wp_reset_postdata();
} else {
    echo \'No posts found.\';
}
 但您的原始代码实际上是在做同样的事情,只是组织方式有点不同。我建议添加
wp_reset_postdata() 调用您的代码,以便恢复原始查询。也许把它排除在外不会有什么坏处,但这将是一个很难在将来追踪到的bug。