Opened 16 years ago
Last modified 10 days ago
#10219 new defect (bug)
"Older Entries" and "Newer Entries" links are wrong when entries displayed in ascending order
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 3.2 |
Component: | Bundled Theme | Keywords: | has-test-info has-patch |
Focuses: | ui, accessibility, template | Cc: |
Description
I added "?order=ASC" to a tag URL I was sending out to some people, because I wanted them to view a set of blog postings in ascending chronological order, and I noticed that the "Older Entries" and "Newer Entries" links at the bottom of the page were reversed.
I fixed this with the attached changes to the default theme. I don't know if this is the "right" fix, but it worked for me, and if it isn't quite wrong, perhaps at least it will give a more experienced WordPress developer than I an idea for how to fix it properly.
Attachments (3)
Change History (29)
#1
@
16 years ago
- Component changed from General to Template
- Keywords needs-patch added
- Milestone changed from Unassigned to 2.9
- Priority changed from normal to low
- Severity changed from normal to minor
the functions should be fixed, rather.
#3
@
15 years ago
The functions should probably swap behavior when order is swapped.
Closed #10219 as a duplicate.
#4
@
15 years ago
- Milestone changed from 3.0 to Future Release
- Type changed from defect (bug) to enhancement
#6
@
10 years ago
- Keywords needs-testing added
- Priority changed from low to normal
- Severity changed from minor to normal
#7
@
10 years ago
For these reasons I believe this should be closed:
- The issue here isn't a matter of the get_* functions passing invalid urls, it's a matter of a theme's use of the label arg previous_/next_posts_link() and popular disregard for an
order
query param. - The default labels for these functions' nomenclature is correct since it uses
Next Page »
and« Previous Page
, instead of the Older/Newer.
However, I'm assuming we want to fix this issue with older core themes (pre-twenty-thirteen), which IMO is a superfluous, I'll work on those patches now.
#8
@
10 years ago
Since @chriscct7 punted this for @nacin to review I'm going to make this easier to understand just in case the circular logic is causing a misunderstanding.
Note: this example is using twenty thirteen...
The "older/newer" terminology isn't correct for obvious reasons, this isn't because the function is using the wrong terminology based on ascending order being used, it's because the labels being passed to the functions are incorrectly set.
This shows that without the labels being sent that the functions return the correct labels.
So, it's not a matter of switching the labels to something dependent on the sort order, it's a matter of the labels these older themes are using.
I can patch these older themes and I'll likely just do it since I'm now invested in this ticket (since my plan was to move on to another here at Contributor Day).
@
10 years ago
Minor mods of previous patch, along with additional support of twenty-twelve and twenty-eleven.
#9
@
10 years ago
- Keywords has-patch added; needs-patch removed
Marking this as having a patch; "needs-testing" can be removed because unit tests can't be written for this type of bug (AFAIK), instead I tested the themes patched. I've attached images of each theme below to show that we don't need to worry about the order of these links/elements (i.e. since "Older posts" link could be after "Newer posts" in the markup) and the CSS floating the elements improperly/non-aligned.
#10
@
4 weeks ago
- Component changed from Posts, Post Types to Bundled Theme
- Focuses ui accessibility added
- Keywords good-first-bug has-test-info needs-patch added; needs-testing has-patch removed
- Type changed from enhancement to defect (bug)
- Version set to 3.2
Reproduction Report
Description
✅ This report validates that the issue can be reproduced.
Environment
- WordPress: 6.9-alpha-60093-src
- PHP: 8.2.28
- Server: nginx/1.27.5
- Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
- Browser: Chrome 137.0.0.0
- OS: Windows 10/11
- Theme: Twenty Thirteen 4.4
- MU Plugins: None activated
- Plugins:
- Test Reports 1.2.0
Testing Instructions
- Add many posts and assign the same TAG to all, for example tag
test
- Go to
/tag/test/?order=ASC
- Check the order and the navigation buttons
- 🐞
Older Posts
/Newer Posts
links are switched around. Older posts are linking to Newer posts and Newer Posts are linking to Older Posts.
- Important Note: If you switch to
/tag/test/?order=DESC
then links are correct. - The problem here is that
Older Posts
/Newer Posts
don't take in consideration theorder
parameter.
Actual Results
- ✅ Error condition occurs (reproduced).
Additional Notes
- For the screencast I'm using 2013, but manually I've tested all themes from 2011 to 2025 and this is affecting the following themes:
- 🐞 2011
- 🐞 2012
- 🐞 2013
- 🐞 2019
- 🐞 2020
- 🐞 2021
- 2014, 2015, 2016, 2017, 2022, 2023, 2024, 2025 doesn't use the Older/Newer Posts but a regular pagination, or a next/previous page format, so this issue doesn't affect these themes
- Given that the patches are not applying, and they are so old, I'm adding back
needs-patch
to see if it brings some attention. I think that this is interesting because it might also be affecting future themes.
- I believe that this could impact
Accessibility
because texts are giving wrong directions.
Supplemental Artifacts
Screencast with the problem:
https://f003.backblazeb2.com/file/wordpress-videos/wp-videos/2025/06/10219.mp4
This ticket was mentioned in PR #9079 on WordPress/wordpress-develop by @shreya0shrivastava.
3 weeks ago
#11
- Keywords has-patch added; needs-patch removed
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 order
query 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.
#12
follow-up:
↓ 13
@
3 weeks ago
I've created a new PR for fixing this issue in the Twenty Twenty-One theme via the twenty_twenty_one_the_posts_navigation()
function and made labels dynamic according to the order
query var.
Thanks!
#13
in reply to:
↑ 12
;
follow-up:
↓ 14
@
3 weeks ago
Replying to shreya0shrivastava:
I've created a new PR for fixing this issue in the Twenty Twenty-One theme via the
twenty_twenty_one_the_posts_navigation()
function and made labels dynamic according to theorder
query var.
Thanks!
Hello Shreya
Looks mostly good for me
I think you can create a PR per theme of the other 5 I mentioned, following more or less the same philosophy you took here.
#14
in reply to:
↑ 13
;
follow-up:
↓ 22
@
3 weeks ago
Replying to SirLouen:
Replying to shreya0shrivastava:
I've created a new PR for fixing this issue in the Twenty Twenty-One theme via the
twenty_twenty_one_the_posts_navigation()
function and made labels dynamic according to theorder
query var.
Thanks!
Hello Shreya
Looks mostly good for me
I think you can create a PR per theme of the other 5 I mentioned, following more or less the same philosophy you took here.
Thank you for the review!
I'll be creating PRs for the other themes shortly.
#15
@
3 weeks ago
- Keywords good-first-bug removed
- Milestone set to Awaiting Review
Please avoid creating new translatable strings in these themes, especially in their templates.
Twenty Twenty-One can use the existing strings.
@shreya0shrivastava commented on PR #9079:
3 weeks ago
#16
@sabernhardt Thank you for the review! I've made the suggested changes.
This ticket was mentioned in PR #9082 on WordPress/wordpress-develop by @shreya0shrivastava.
3 weeks ago
#17
Similar to #9079
Fixes the issue: "Older Entries" and "Newer Entries" links are wrong when entries displayed in ascending order for the Twenty Twenty theme by adding dynamic labels according to the order query var (DESC or ASC). More info in the trac ticket.
Trac ticket: https://core.trac.wordpress.org/ticket/10219
This ticket was mentioned in PR #9089 on WordPress/wordpress-develop by @shreya0shrivastava.
3 weeks ago
#18
Similar to PR, PR
Fixes the issue: "Older Entries" and "Newer Entries" links are wrong when entries displayed in ascending order for the Twenty Nineteen theme by adding dynamic labels according to the order query var (DESC or ASC). More info in the trac ticket.
Trac ticket: https://core.trac.wordpress.org/ticket/10219
This ticket was mentioned in PR #9090 on WordPress/wordpress-develop by @shreya0shrivastava.
3 weeks ago
#19
Similar to PR, PR, PR
Fixes the issue: "Older Entries" and "Newer Entries" links are wrong when entries displayed in ascending order for the Twenty Thirteen theme by adding dynamic labels according to the order query var (DESC or ASC). Also updated the div classes (These classes controlled the position of the labels) for the nav labels to switch according to the order. For context:
---
Trac ticket: https://core.trac.wordpress.org/ticket/10219
This ticket was mentioned in PR #9133 on WordPress/wordpress-develop by @shreya0shrivastava.
2 weeks ago
#20
Similar to PR
Fixes the issue: "Older Entries" and "Newer Entries" links are wrong when entries displayed in ascending order for the Twenty Twelve theme by adding dynamic labels according to the order query var (DESC or ASC). More info in trac ticket.
---
Trac ticket: https://core.trac.wordpress.org/ticket/10219
This ticket was mentioned in PR #9135 on WordPress/wordpress-develop by @shreya0shrivastava.
2 weeks ago
#21
Similar to PR, PR
Fixes the issue: "Older Entries" and "Newer Entries" links are wrong when entries displayed in ascending order for the Twenty Eleven theme by adding dynamic labels according to the order query var (DESC or ASC). More info in trac ticket.
---
Trac ticket: https://core.trac.wordpress.org/ticket/10219
#22
in reply to:
↑ 14
;
follow-up:
↓ 23
@
2 weeks ago
Replying to shreya0shrivastava:
Replying to SirLouen:
Replying to shreya0shrivastava:
I've created a new PR for fixing this issue in the Twenty Twenty-One theme via the
twenty_twenty_one_the_posts_navigation()
function and made labels dynamic according to theorder
query var.
Thanks!
Hello Shreya
Looks mostly good for me
I think you can create a PR per theme of the other 5 I mentioned, following more or less the same philosophy you took here.
Thank you for the review!
I'll be creating PRs for the other themes shortly.
I've created the PRs for the other 5 themes as well. Looking forward to the feedback!
cc: @SirLouen @sabernhardt
#23
in reply to:
↑ 22
@
2 weeks ago
Replying to shreya0shrivastava:
I've created the PRs for the other 5 themes as well. Looking forward to the feedback!
Reviewed, sent some comment.
@sabernhardt commented on PR #9090:
2 weeks ago
#24
For Twenty Thirteen and older themes, nav-previous
still needs to be in the markup before nav-next
so the visual order and DOM order match. (See Meaningful Sequence and Focus Order.)
I also do not think Twenty Thirteen should add the 10-pixel margin on the opposite side of the meta-nav
arrows.
@shreya0shrivastava commented on PR #9090:
2 weeks ago
#25
Refactored to remove redundant checks using $is_desc
and preserved the .nav-previous / .nav-next DOM order. Please let me know if this looks good, I’ll follow the same pattern in the PRs for the older themes as well. Thanks!
cc: @sabernhardt
patch to to switch the links when displaying in ascending order