WordPress.org

Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#6513 closed defect (bug) (fixed)

Older/Newer Post error in classic Theme

Reported by: private_meta Owned by:
Milestone: 2.6 Priority: low
Severity: minor Version: 2.5
Component: Template Keywords: has-patch 2nd-opinion posts_nav_link classic
Focuses: 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 9 years ago.
Classic Theme index.php patch
6513.diff (539 bytes) - added by Otto42 9 years ago.
Fixed patch

Download all attachments as: .zip

Change History (12)

@private_meta
9 years ago

Classic Theme index.php patch

#1 @lloydbudd
9 years ago

  • 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

#2 follow-up: @stevegk
9 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.

#3 @Otto42
9 years ago

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

@Otto42
9 years ago

Fixed patch

#4 in reply to: ↑ 2 @Otto42
9 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.

#5 @stevegk
9 years ago

Thanks for the explanation - it all makes sense now.

Patch works fine - tested on 2.5.

#6 @filosofo
9 years ago

  • Keywords posts_nav_link classic added

#7 @ryan
9 years ago

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

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

#8 @ryan
9 years ago

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

#9 @ryan
9 years ago

  • Milestone changed from 2.5.2 to 2.9

Milestone 2.5.2 deleted

#10 @westi
9 years ago

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