我如何让评论区显示出来?

时间:2013-01-17 作者:Hithere Paperbag

我的主题似乎没有显示注释部分,这是我在index.php 模板文件夹中的文件

<!-- Start the Loop. -->
<?php get_header(); ?>

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

 <!-- Test if the current post is in category 3. -->
 <!-- If it is, the div box is given the CSS class "post-cat-three". -->
 <!-- Otherwise, the div box is given the CSS class "post". -->
 <?php if ( in_category(\'3\') ) { ?>
           <div class="post-cat-three">
 <?php } else { ?>
           <div class="post">
 <?php } ?>

 <!-- Display the Title as a link to the Post\'s permalink. -->
 <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>

 <!-- Display the date (November 16th, 2009 format) and a link to other posts by this posts author. -->
 <small><?php the_time(\'F jS, Y\') ?> by <?php the_author_posts_link() ?></small>

 <!-- Display the Post\'s content in a div box. -->
 <div class="entry">
   <?php the_content(); ?>
 </div>

 <!-- Display a comma separated list of the Post\'s Categories. -->
 <p class="postmetadata">Posted in <?php the_category(\', \'); ?></p>
 </div> <!-- closes the first div box -->

 <!-- Stop The Loop (but note the "else:" - see next line). -->
 <?php endwhile; else: ?>

 <!-- The very first "if" tested to see if there were any Posts to -->
 <!-- display.  This "else" part tells what do if there weren\'t any. -->
 <p>Sorry, no posts matched your criteria.</p>

 <!-- REALLY stop The Loop. -->
 <?php endif; ?>

1 个回复
最合适的回答,由SO网友:Jamie 整理而成

如果你看一下212主题。你可以看到他们是如何得到评论的。全方位查看。php文件,您可以看到以下代码

 <?php comments_template( \'\', true ); ?>
这将调用代码以获取您的注释部分。现在你必须确保你的主题有评论。php。您还可以检查twentyEleven和twentyTen主题以查看不同的方法

结束

相关推荐

如何正确使用Comments-template.php

我想修改已登录用户和未登录用户的评论表单。我通过更改注释修改了未登录用户的表单。php,但我不太确定如何为登录用户修改我的表单。我知道我必须使用comments\\u template(),但每当我尝试在页面中使用它时。php,我遇到这样的错误Notice: Undefined variable: args in {PATH}/twwr-theme/comments-template.php on line 13 这些是我评论的内容。php,有点乱<?php if (!empty