Ticket #3924 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

Page order specified on page writing screen is ignored by default

Reported by: johnbillion Assigned to: anonymous
Priority: normal Milestone: 2.2
Component: Template Version: 2.2
Severity: minor Keywords: has-patch
Cc:

Description

By default, pages are listed in alphabetical order when wp_list_pages is used. The page order specified on the page writing screen is ignored unless it is explicitly set with the sort_column parameter within the template.

Steps to reproduce:

  1. Create two or more pages from Write > Write Page and specify a page order using the Page Order box on the right hand side. For example create a page named "Hello World" with page order 1 and a page named "A Boring Page" with page order 2.
  2. Visit your blog home page and note the page order of the list of pages in the sidebar is ignored and the pages are listed alphabetically.

I propose that wp_list_pages should instead sort first by menu_order and then by post_title (see attached patch). This means if no page order is specified, pages will still be sorted alphabetically which is more asthetically pleasing. However if a page order is specified (for one or more page) then it will take priority over the alphabetical sorting.

Example of a scenario:

Three pages are on your blog:

  1. The default "About" with no page order (defaults to 0).
  2. "Hello World" with no page order (defaults to 0).
  3. "A Boring Page" with page order of 1.

As it is now, these pages would be listed alphabetically, ignoring the wishes of "A Boring Page" to be listed at the bottom.

With my change to wp_list_pages "A Boring Page" will get listed at the bottom, as per the specified Page Order, but the rest of the pages will still be listed alphabetically. Which is nice.

Attachments

3924.diff (0.6 kB) - added by johnbillion on 03/07/07 16:41:45.
Patch to allow Page Order to take priority over alphabetical listing of pages
3924.2.diff (0.6 kB) - added by johnbillion on 03/07/07 19:47:13.
Same as patch 3924 but with full path from root

Change History

03/07/07 16:41:45 changed by johnbillion

  • attachment 3924.diff added.

Patch to allow Page Order to take priority over alphabetical listing of pages

03/07/07 17:07:38 changed by johnbillion

  • priority changed from low to normal.
  • component changed from Administration to Template.
  • severity changed from normal to minor.

03/07/07 18:41:59 changed by foolswisdom

  • keywords set to has-patch.
  • version set to 2.2.
  • milestone changed from 2.3 to 2.2.

03/07/07 19:47:13 changed by johnbillion

  • attachment 3924.2.diff added.

Same as patch 3924 but with full path from root

03/16/07 08:19:12 changed by markjaquith

  • status changed from new to closed.
  • resolution set to fixed.

(In [5049]) have wp_list_pages() default to menu_order sorting and only use post_title sorting as a secondary sort. props johnbillion. fixes #3924 for trunk.