覆盖类别归档输出的默认设置(二十分之一)

时间:2014-09-06 17:39:04

标签: php wordpress

我在自定义类别模板中有此代码段,该模板输出该类别的最后X个帖子。

<?php if ( have_posts() ) : ?>

    <?php while ( have_posts() ) : the_post(); get_template_part( 'content', get_post_format() );   endwhile; twentytwelve_content_nav( 'nav-below' ); ?>

<?php else : ?>
    <?php get_template_part( 'content', 'none' ); ?>
<?php endif; ?>

问题是这会将帖子作为摘录输出..如何在不影响所有其他循环的情况下将其更改为the_content()?我只需要在这里拥有the_content。

我是否需要手动输出标题,然后是日期,然后是作者,然后是the_content()或者我可以直接替换上面代码段中的内容吗?

1 个答案:

答案 0 :(得分:0)

根据您提供的内容,您似乎已经自定义了content.php模板。

要显示仅针对您的类别页面的内容,请查看,您需要添加该条件。由于你没有添加content.php的代码,我无法准确地说出添加它的位置,但你必须做这样的事情

if(is_category()) {
  the_content();
}else{
  the_excerpt();
}