Opened 18 years ago
Closed 18 years ago
#3924 closed defect (bug) (fixed)
Page order specified on page writing screen is ignored by default
Reported by: | johnbillion | Owned by: | |
---|---|---|---|
Milestone: | 2.2 | Priority: | normal |
Severity: | minor | Version: | 2.2 |
Component: | Template | Keywords: | has-patch |
Focuses: | 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:
- 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. - 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:
- The default "About" with no page order (defaults to 0).
- "Hello World" with no page order (defaults to 0).
- "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.
Patch to allow Page Order to take priority over alphabetical listing of pages