更新时间:2022-12-11 13:35:24
来自 Wordpress Codex 在query_posts()
:
...
...
例如,在首页上,您通常会看到最新的10条帖子.如果您只想显示5个帖子(并且不关心分页),则可以这样使用query_posts():
For example, on the homepage, you would normally see the latest 10 posts. If you want to show only 5 posts (and don't care about pagination), you can use query_posts() like so:
query_posts( 'posts_per_page=5' );
将您的query_posts()
更改为此:
query_posts(array('posts_per_page' => 3, 'paged' => get_query_var('page')));