Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#6513 closed defect (bug) (fixed)

Older/Newer Post error in classic Theme

Reported by: private_meta Owned by: anonymous
Priority: low Milestone: 2.6
Component: Template Version: 2.5
Severity: minor Keywords: has-patch 2nd-opinion posts_nav_link classic
Cc:

Description

The classic theme, when spanning over several pages, has the link texts "Older Entries" and "Newer Entries" switched around, being on the first page, going back in time you have to click on "Newer Entries". I attached a

Attachments (2)

wp_theme_classic_index.diff (461 bytes) - added by private_meta 5 years ago.
Classic Theme index.php patch
6513.diff (539 bytes) - added by Otto42 5 years ago.
Fixed patch

Download all attachments as: .zip

Change History (12)

Classic Theme index.php patch

  • Keywords needs-testing removed
  • Milestone changed from 2.6 to 2.5.1

Confirmed bug and fix.

This is correct on WordPress.com
http://svn.automattic.com/wpcom-themes/classic/index.php

comment:2 follow-up: ↓ 4   stevegk5 years ago

  • Keywords 2nd-opinion added

The above patch makes the links return the correct posts for the wording on the link, but where there are enough post for both previous and next links to be displayed they are not in a logical (chronological) order.

Newer Posts » — « Older Posts

Reading the codex entry http://codex.wordpress.org/Next_and_Previous_Links the patch also goes against the documentation. It seems that the function is returning next results when it should return previous results and vice versa.

Tested against 2.3.3.

  • Component changed from General to Template

Patch is pointing arrows inwards strangely. Attaching new patch, which is more in line with wordpress.com svn as given above.

Otto425 years ago

Fixed patch

comment:4 in reply to: ↑ 2   Otto425 years ago

Replying to stevegk:

Reading the codex entry http://codex.wordpress.org/Next_and_Previous_Links the patch also goes against the documentation. It seems that the function is returning next results when it should return previous results and vice versa.

No, the codex was just wrong/confusing. I fixed it.

Basically, the problem is that "previous" and "next" are not referring to chronological time, they are referring to pages and post ordering.

Post ordering is arbitrary. It defaults to "post_date DESC", but it can be anything, really. If you change the query_posts to put it in ASC ordering, then the oldest post will show up first, and the previous/next links won't change. Oh, they'll point to different posts, but they'll still point to the previous/next posts in the given ordering.

"Next" refers to the next post in the given ordering, whatever it may be. By default, "next" = "older posts". This is admittedly confusing if you think of next as forward in time, but it is actually forward in the returned set of posts from the database, whatever order they may be in.

Thanks for the explanation - it all makes sense now.

Patch works fine - tested on 2.5.

  • Keywords posts_nav_link classic added

comment:7   ryan5 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [7869]) Classic theme navigation fix from Otto42. fixes #6513 for trunk

comment:8   ryan5 years ago

(In [7870]) Classic theme navigation fix from Otto42. fixes #6513 for 2.5

comment:9   ryan5 years ago

  • Milestone changed from 2.5.2 to 2.9

Milestone 2.5.2 deleted

  • Milestone changed from 2.9 to 2.6
Note: See TracTickets for help on using tickets.