Twenty Twenty-One: fix "Older Posts" label for archive pages with respect to order#9079
Twenty Twenty-One: fix "Older Posts" label for archive pages with respect to order#9079shrivastavanolo wants to merge 3 commits intoWordPress:trunkfrom
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. |
|
Hi @shrivastavanolo! 👋 Thank you for your contribution to WordPress! 💖 It looks like this is your first pull request to No one monitors this repository for new pull requests. Pull requests must be attached to a Trac ticket to be considered for inclusion in WordPress Core. To attach a pull request to a Trac ticket, please include the ticket's full URL in your pull request description. Pull requests are never merged on GitHub. The WordPress codebase continues to be managed through the SVN repository that this GitHub repository mirrors. Please feel free to open pull requests to work on any contribution you are making. More information about how GitHub pull requests can be used to contribute to WordPress can be found in the Core Handbook. Please include automated tests. Including tests in your pull request is one way to help your patch be considered faster. To learn about WordPress' test suites, visit the Automated Testing page in the handbook. If you have not had a chance, please review the Contribute with Code page in the WordPress Core Handbook. The Developer Hub also documents the various coding standards that are followed:
Thank you, |
Test using WordPress PlaygroundThe 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
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
sabernhardt
left a comment
There was a problem hiding this comment.
Maintain the existing Newer <span class="nav-short">posts</span> and Older <span class="nav-short">posts</span> strings, in new variables.
|
@sabernhardt Thank you for the review! I've made the suggested changes. |
There was a problem hiding this comment.
This looks good.
In default (descending) order, the navigation continues to appear the same as it did before the patch. The screenshots show :focus styles for the first link in page navigation (DOM order), and I checked English and French.
With ?order=ASC, the labels switch accordingly.
On smaller screens, it still hides "posts":

Full-page screenshots show three posts. The date is the same for all, but I published each chapter in order from 1 to 12. (I changed the published dates later, before checking other themes.)
- Before patch, default order
- Before patch, ascending order
- With patch, default order
- With patch, ascending order
A diff shows the text changes for the ASC page, before and after applying the patch, within the markup:
<nav class="navigation pagination" aria-label="Posts pagination">
<h2 class="screen-reader-text">Posts pagination</h2>
- <div class="nav-links"><a class="prev page-numbers" href="http://localhost/svn/src/tag/alice/?order=ASC"><svg class="svg-icon" width="24" height="24" aria-hidden="true" role="img" focusable="false" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M20 13v-2H8l4-4-1-2-7 7 7 7 1-2-4-4z" fill="currentColor"/></svg> <span class="nav-prev-text">Newer <span class="nav-short">posts</span></span></a>
+ <div class="nav-links"><a class="prev page-numbers" href="http://localhost/svn/src/tag/alice/?order=ASC"><svg class="svg-icon" width="24" height="24" aria-hidden="true" role="img" focusable="false" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M20 13v-2H8l4-4-1-2-7 7 7 7 1-2-4-4z" fill="currentColor"/></svg> <span class="nav-prev-text">Older <span class="nav-short">posts</span></span></a>
<a class="page-numbers" href="http://localhost/svn/src/tag/alice/?order=ASC">Page 1</a>
<span aria-current="page" class="page-numbers current">Page 2</span>
<span class="page-numbers dots">…</span>
<a class="page-numbers" href="http://localhost/svn/src/tag/alice/page/4/?order=ASC">Page 4</a>
-<a class="next page-numbers" href="http://localhost/svn/src/tag/alice/page/3/?order=ASC"><span class="nav-next-text">Older <span class="nav-short">posts</span></span> <svg class="svg-icon" width="24" height="24" aria-hidden="true" role="img" focusable="false" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="m4 13v-2h12l-4-4 1-2 7 7-7 7-1-2 4-4z" fill="currentColor"/></svg></a></div>
+<a class="next page-numbers" href="http://localhost/svn/src/tag/alice/page/3/?order=ASC"><span class="nav-next-text">Newer <span class="nav-short">posts</span></span> <svg class="svg-icon" width="24" height="24" aria-hidden="true" role="img" focusable="false" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="m4 13v-2h12l-4-4 1-2 7 7-7 7-1-2 4-4z" fill="currentColor"/></svg></a></div>
</nav>

Fixes the issue: "Older Entries" and "Newer Entries" links are wrong when entries displayed in ascending order for the Twenty Twenty-One theme by adding dynamic labels according to the
orderquery var (DESC or ASC)Trac ticket: https://core.trac.wordpress.org/ticket/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.