尝试在wordpress中显示帖子,但将页面作为输出

时间:2012-12-22 17:38:18

标签: wordpress-plugin wordpress

我正在尝试在roots theme的{​​{1}}文件的首页上显示帖子。

我已将循环添加为

base.php

然而,这仍然只显示第一页的内容和标题。

如何让它显示帖子?我在设置下将帖子数量设置为3 - >读 。

2 个答案:

答案 0 :(得分:4)

if (have_posts()) : $count = 0;            
while (have_posts()) : the_post(); $count++;
      echo '<h2>';
      the_title(); 
      echo '</h2>';
      the_content( 'Read the full post »' ); 
endwhile;

ENDIF;

答案 1 :(得分:0)

想出来。我使用的是roots主题。在这个主题中,有base.php文件需要行

<?php include roots_template_path()?>

没有这条线不允许它拿起正确的模板。