admin管理员组文章数量:1279237
I think the way wordpress display previous and next posts is basically non sense, with next posts on the left side, and older posts on the right side.
I am using the code
<?php posts_nav_link() ?>
is there a way to reverse such order?
I think the way wordpress display previous and next posts is basically non sense, with next posts on the left side, and older posts on the right side.
I am using the code
<?php posts_nav_link() ?>
is there a way to reverse such order?
Share Improve this question asked Apr 4, 2012 at 10:41 akmurakmur 3951 gold badge8 silver badges19 bronze badges4 Answers
Reset to default 2This is because it is, by default, done as 'previous page' on the left, and 'next page' on the right. Posts appear in reverse chronological order, with the latest post first, so 'next page' means going back in time. So in terms of pages it makes sense, in terms of chronology it doesn't.
Anyway... this should work:
<div class="navigation">
<div class="alignleft"><?php next_posts_link('« Older Entries','') ?></div>
<div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div>
</div>
Take a look at this
http://codex.wordpress/Function_Reference/posts_nav_link
Note: since weblog posts are traditionally listed in reverse chronological order (with most recent posts at the top), there is some ambiguity in the definition of "next page". WordPress defines "next page" as the "next page toward the past". In WordPress 1.5, the default Kubrick theme addresses this ambiguity by labeling the "next page" link as "previous entries". See Example: Kubrick Theme Format.
You can use next_posts_link() and previous_posts_link() separately and place where ever you want in your template.....
The function...
posts_nav_link( $separator, $prev_label, $next_label );
...calls...
get_posts_nav_link()
...where the defaults for the previous function come from. If then the query_var
$query->max_num_pages // must be greater than one to trigger
...is set, the functions...
get_previous_posts_link()
get_next_posts_link()
get called. If then...
$query->paged // must be set lower than 2
$query->max_num_pages // or equal to $paged
...meets, the function will add a separator between both links.
Another WordPress way to display navigation (pagination):
<nav class="navigation" role="navigation" aria-label="Search Navigation">
<div class="nav-links">
<?php echo paginate_links(); ?>
</div>
</nav>
This will display the pagination having Next to the right side and Back to the left side. It will also display the pagination numbers. You can hide these with CSS if necessary.
本文标签: navigationreverse nextprev page order
版权声明:本文标题:navigation - reverse nextprev page order 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741281905a2370057.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论