Make WordPress Core

Opened 15 years ago

Last modified 6 years ago

#10219 new enhancement

"Older Entries" and "Newer Entries" links are wrong when entries displayed in ascending order

Reported by: jikamens's profile jikamens Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: needs-testing has-patch
Focuses: 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)

ASC-links.patch (3.8 KB) - added by jikamens 15 years ago.
patch to to switch the links when displaying in ascending order
10219.diff (2.3 KB) - added by obenland 9 years ago.
It's not pretty.
10219-2.diff (5.7 KB) - added by dancameron 9 years ago.
Minor mods of previous patch, along with additional support of twenty-twelve and twenty-eleven.

Download all attachments as: .zip

Change History (12)

@jikamens
15 years ago

patch to to switch the links when displaying in ascending order

#1 @Denis-de-Bernardy
15 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.

#2 @nacin
15 years ago

  • Milestone changed from 2.9 to 3.0

#3 @nacin
15 years ago

The functions should probably swap behavior when order is swapped.

Closed #10219 as a duplicate.

#4 @nacin
15 years ago

  • Milestone changed from 3.0 to Future Release
  • Type changed from defect (bug) to enhancement

#5 @nacin
11 years ago

  • Component changed from Template to Posts, Post Types
  • Focuses template added

#6 @chriscct7
9 years ago

  • Keywords needs-testing added
  • Priority changed from low to normal
  • Severity changed from minor to normal

#7 @dancameron
9 years ago

For these reasons I believe this should be closed:

  1. 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.
  2. 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 @dancameron
9 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.
https://s3.amazonaws.com/f.cl.ly/items/1V3d1R1D2d010e2d0032/Screen%20Shot%202015-12-06%20at%2012.37.00%20PM.png

This shows that without the labels being sent that the functions return the correct labels.
https://s3.amazonaws.com/f.cl.ly/items/2E370x0H351c3e222t2P/Screen%20Shot%202015-12-06%20at%2012.36.36%20PM.png

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).

@obenland
9 years ago

It's not pretty.

@dancameron
9 years ago

Minor mods of previous patch, along with additional support of twenty-twelve and twenty-eleven.

#9 @dancameron
9 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.

https://s3.amazonaws.com/f.cl.ly/items/452I141d2y413k0i0T1g/Screen%20Shot%202015-12-06%20at%203.13.07%20PM.png

https://s3.amazonaws.com/f.cl.ly/items/1G3n223G1j0U2S2i341e/Screen%20Shot%202015-12-06%20at%203.13.57%20PM.png

https://s3.amazonaws.com/f.cl.ly/items/2x272G0c360k2g2c1k34/Screen%20Shot%202015-12-06%20at%203.24.08%20PM.png

Note: See TracTickets for help on using tickets.