Wordpress评论没有在single.php中显示

时间:2014-11-09 18:13:29

标签: php wordpress templates comments

评论未在single.php中显示

这是我在single.php中的代码(我创建了comments.php并从默认的comments.php文件主题中复制了代码):

<?php get_header(); ?>


<div class="content-post container">

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>

    <p><?php the_time('F j, Y'); ?> at <?php the_time('g:i a'); ?> | <?php the_category(', '); ?> | <?php comments_number('No comment', '1 comment', '% comments'); ?></p>

    <?php the_content(); ?>

    <?php wp_list_comments(); ?>



    <?php endwhile; else: ?>

    <h2>Woops...</h2>

    <p>Sorry, no posts we're found.</p>

    <?php endif; ?>

    <p align="center"><?php posts_nav_link(); ?></p>

</div>
<?php get_footer(); ?>

这可能是由于css问题吗?我还安装了Disqus插件,它没有显示

1 个答案:

答案 0 :(得分:1)

此代码看起来不错。可能是几件事:

在管理区域中,转到您查看的帖子,如果您的主题允许,请找到“允许评论”复选框。

尝试更改代码:

wp_list_comments();

为:

comments_template();

如果不起作用,请将其更改。

不知道你的意思是“css问题”。如果是CSS问题,请发表一些评论,然后在浏览器中查看该页面。查看页面源代码,如果注释设置为display:none,您仍然可以在页面源中看到它们,那么您就会知道它是否是CSS问题。