在 WordPress 中对 get_posts() 进行分页
这是我的 WordPress 中的模板页面(已删除 html),它从我的 WordPress 数据库中提取帖子。我想分页,但不知道! :(
我不想得到这样的东西
<<首页 上一页 1 2 3 4 下一页 最后一页 >>
<?php
$postslist = get_posts('numberposts=10&order=ASC');
foreach ($postslist as $post) :
setup_postdata($post);
?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?> </a></li>
<li><?php the_excerpt(); ?></li><br/><hr/>
<?php endforeach; ?>
This a template page in my wordpress (have removed html), it pulls out the posts from my wordpress database. I want to paginate it but have no idea! :(
I wan't to get something like this
<< First Prev 1 2 3 4 Next Last >>
<?php
$postslist = get_posts('numberposts=10&order=ASC');
foreach ($postslist as $post) :
setup_postdata($post);
?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?> </a></li>
<li><?php the_excerpt(); ?></li><br/><hr/>
<?php endforeach; ?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是我使用的分页类:
然后在 page.html 中,我使用了这个:
Here's a pagination class I use:
And then in the page.html, I used this: