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.

@github-actions
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, westonruter, 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

@sabernhardt sabernhardt deleted the t10-older-newer-posts branch October 24, 2025 06:54
@sabernhardt sabernhardt restored the t10-older-newer-posts branch October 25, 2025 00:23
@sabernhardt sabernhardt reopened this Oct 25, 2025
@github-actions
Copy link

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

<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
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the introduction of wp_kses_post() necessary here? It was absent before.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not necessary. I thought I commented about KSES somewhere on the ticket or one of the other themes' PRs, but it seems I just said something on Slack.

Co-authored-by: Weston Ruter <[email protected]>
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.

3 participants