Skip to content

Conversation

sabernhardt
Copy link

@sabernhardt sabernhardt commented Oct 20, 2025

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.

Copy link

github-actions bot commented Oct 20, 2025

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 props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props sabernhardt, shailu25.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link
Author

@sabernhardt sabernhardt left a 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.

with patch, ascending order, English

I also checked French and Hebrew.

with patch, ascending order, French with patch, ascending order, 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">&larr;</span> Older posts</a></div>
-		<div class="nav-next"><a href="http://localhost/svn/src/tag/alice/" >Newer posts <span class="meta-nav">&rarr;</span></a></div>
-	</div><!-- #nav-above -->
+			<div class="nav-previous"><a href="http://localhost/svn/src/tag/alice/page/3/"><span class="meta-nav">&larr;</span> Older posts</a></div>
+	
+			<div class="nav-next"><a href="http://localhost/svn/src/tag/alice/">Newer posts <span class="meta-nav">&rarr;</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">&larr;</span> Older posts</a></div>
-					<div class="nav-next"><a href="http://localhost/svn/src/tag/alice/" >Newer posts <span class="meta-nav">&rarr;</span></a></div>
-				</div><!-- #nav-below -->
+									<div class="nav-previous"><a href="http://localhost/svn/src/tag/alice/page/3/"><span class="meta-nav">&larr;</span> Older posts</a></div>
+				
+									<div class="nav-next"><a href="http://localhost/svn/src/tag/alice/">Newer posts <span class="meta-nav">&rarr;</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">&larr;</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">&rarr;</span></a></div>
-	</div><!-- #nav-above -->
+			<div class="nav-previous"><a href="http://localhost/svn/src/tag/alice/?order=ASC"><span class="meta-nav">&larr;</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">&rarr;</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">&larr;</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">&rarr;</span></a></div>
-				</div><!-- #nav-below -->
+									<div class="nav-previous"><a href="http://localhost/svn/src/tag/alice/?order=ASC"><span class="meta-nav">&larr;</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">&rarr;</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).

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">&larr;</span> Older posts', 'twentyten' ) ); ?></div>
<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?></div>
<?php if ( $prev_link ) : ?>
<div class="nav-previous"><?php echo wp_kses_post( $prev_link ); ?></div>
Copy link
Author

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.

@shail-mehta
Copy link
Member

shail-mehta commented Oct 21, 2025

When Order By ASC

Before After
twenty-ten-before twenty-ten-after

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants