WordPress评论框不会出现在自定义帖子中


Wordpress Comments box is not coming on custom post

我正在尝试在自定义帖子上添加评论框comments_template(); 但不确定为什么它不来?请查看以下代码,让我知道我犯了什么错误?

<?php
$temp = $wp_query; $wp_query= null;
$wp_query = new WP_Query(); $wp_query->query('showposts=1' . '&paged='.$paged);
while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
    <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
    <div>
    <?php if ( has_post_thumbnail() ) : ?>
        <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
            <?php the_post_thumbnail(); ?>
        </a>
    <?php endif; ?>
    </div>
    <?php the_content(); ?>
    <?php endwhile; ?>
    <?php comments_template(); ?>

<?php if ($paged > 1) { ?>
<nav id="nav-posts">
  <div class="prev"><?php next_posts_link('PREVIOUS POSTS'); ?></div>
  <div class="next"><?php previous_posts_link('NEXT POSTS'); ?></div>
</nav>
<?php } else { ?>
<nav id="nav-posts">
  <div class="prev"><?php next_posts_link('PREVIOUS POSTS'); ?></div>
</nav>

像这样注册自定义帖子类型:

$args = array(
            'menu_icon'          => 'dashicons-format-video',
            'labels'             => $labels,
            'public'             => true,
            'publicly_queryable' => true,
            'show_ui'            => true,
            'show_in_menu'       => true,
            'query_var'          => true,
            //'rewrite'            => array( 'slug' => 'book' ),
            'capability_type'    => 'post',
            'has_archive'        => true,
            'hierarchical'       => false,
            'menu_position'      => null,
            'supports'           => array('title', 'editor', 'comments')
        );
        register_post_type( 'custom_type', $args );