我有一个显示最新消息的wordpress页面。我想分页这些新闻了,这是我的代码:Wordpress分页
<?php
query_posts('posts_per_page=5');
?>
<?php
while (have_posts()):
the_post();
?>
<div class="news"><h1><a href="<?php
the_permalink();
?>" rel="news" title="<?php
the_title_attribute();
?>"><?php
the_title();
?></a></h1>
<p>
<?php
the_excerpt();
?>
</p>
</div>
<?php
endwhile;
?>
<p><?php
wp_pagenavi();
?></p>
<?php
wp_reset_query();
?>
我有一个页面内容的代码,我使用的exec-PHP插件来解析的代码。问题是,当我点击页面2时,我仍然看到页面1的消息。所以分页不起作用。
有什么想法?
在我的档案(archive.php)页面上我也尝试了分页,但是当我点击第2页时,我在主页上重定向。
请帮帮我!
我假定query_posts()需要的参数,并自动地调整基于 'CURRENT_PAGE' 参数的查询。我也不知道里面的代码。 :○ – fabrik 2010-07-05 14:04:28