-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Twenty Ten: fix "Older posts" and "Newer posts" links for archive pages when in ascending order #10359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN:
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The navigation appears the same as it did before the patch, regardless of order. The screenshots show Firefox's :focus-visible
outline for the first link in the bottom page navigation (according to DOM order). Note that the top navigation does not appear on the first page.

I also checked French and Hebrew.


In default descending order, the markup has different spacing between elements, and wp_kses_post()
removes the space after the href
values. Otherwise, it is the same as before the patch in both the top and bottom areas.
<div id="nav-above" class="navigation">
- <div class="nav-previous"><a href="http://localhost/svn/src/tag/alice/page/3/" ><span class="meta-nav">←</span> Older posts</a></div>
- <div class="nav-next"><a href="http://localhost/svn/src/tag/alice/" >Newer posts <span class="meta-nav">→</span></a></div>
- </div><!-- #nav-above -->
+ <div class="nav-previous"><a href="http://localhost/svn/src/tag/alice/page/3/"><span class="meta-nav">←</span> Older posts</a></div>
+
+ <div class="nav-next"><a href="http://localhost/svn/src/tag/alice/">Newer posts <span class="meta-nav">→</span></a></div>
+ </div><!-- #nav-above -->
<div id="nav-below" class="navigation">
- <div class="nav-previous"><a href="http://localhost/svn/src/tag/alice/page/3/" ><span class="meta-nav">←</span> Older posts</a></div>
- <div class="nav-next"><a href="http://localhost/svn/src/tag/alice/" >Newer posts <span class="meta-nav">→</span></a></div>
- </div><!-- #nav-below -->
+ <div class="nav-previous"><a href="http://localhost/svn/src/tag/alice/page/3/"><span class="meta-nav">←</span> Older posts</a></div>
+
+ <div class="nav-next"><a href="http://localhost/svn/src/tag/alice/">Newer posts <span class="meta-nav">→</span></a></div>
+ </div><!-- #nav-below -->
With ?order=ASC
, the links' href
attributes switch, without changing the appearance. These diff
views highlight the link changes on the ASC
page, before and after applying the patch, within the markup:
<div id="nav-above" class="navigation">
- <div class="nav-previous"><a href="http://localhost/svn/src/tag/alice/page/3/?order=ASC" ><span class="meta-nav">←</span> Older posts</a></div>
- <div class="nav-next"><a href="http://localhost/svn/src/tag/alice/?order=ASC" >Newer posts <span class="meta-nav">→</span></a></div>
- </div><!-- #nav-above -->
+ <div class="nav-previous"><a href="http://localhost/svn/src/tag/alice/?order=ASC"><span class="meta-nav">←</span> Older posts</a></div>
+
+ <div class="nav-next"><a href="http://localhost/svn/src/tag/alice/page/3/?order=ASC">Newer posts <span class="meta-nav">→</span></a></div>
+ </div><!-- #nav-above -->
<div id="nav-below" class="navigation">
- <div class="nav-previous"><a href="http://localhost/svn/src/tag/alice/page/3/?order=ASC" ><span class="meta-nav">←</span> Older posts</a></div>
- <div class="nav-next"><a href="http://localhost/svn/src/tag/alice/?order=ASC" >Newer posts <span class="meta-nav">→</span></a></div>
- </div><!-- #nav-below -->
+ <div class="nav-previous"><a href="http://localhost/svn/src/tag/alice/?order=ASC"><span class="meta-nav">←</span> Older posts</a></div>
+
+ <div class="nav-next"><a href="http://localhost/svn/src/tag/alice/page/3/?order=ASC">Newer posts <span class="meta-nav">→</span></a></div>
+ </div><!-- #nav-below -->
Full-page screenshots show three posts, with different published dates (matching the chapter number to the day of the month).
- Before patch, default order
- Before patch, ascending order
- With patch, default order
- With patch, ascending order
I ran each translation through wp_kses_post()
to make sure they all display properly.
<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">←</span> Older posts', 'twentyten' ) ); ?></div> | ||
<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">→</span>', 'twentyten' ) ); ?></div> | ||
<?php if ( $prev_link ) : ?> | ||
<div class="nav-previous"><?php echo wp_kses_post( $prev_link ); ?></div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reuses the variables assigned earlier in the file, within the same $wp_query->max_num_pages > 1
condition.
Updates link references for both navigation sections of Twenty Ten's
loop.php
.Props: shreya0shrivastava
Trac 10219
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.