Sorting page lists with multiple levels
Permalink
Hi All,
I have a page structure something like this...
Rock gods (this page has the page list on it)
- Guitarists
-- Jimi Hendrix
-- Van Halen
- Bassists
-- Flea
-- Steve Harris
I'm using a page list with the "Include all child pages" checked to bring all the pages into a single page list.
The order now goes somewhat randomly, back and forward between the sections...
Jimi Hendrix, Flea, Van Halen, Steve Harris
It seems to order them as "Guitar, Bass, Guitar, Bass" and so on. What I really want it to do is "Guitar, Guitar, Bass, Bass".
In other words I need it to list all the sub-pages from the first child, then all the sub-pages from the next child.
The way this is implemented it's not an option to use 2 Page lists (I have a custom template that needs everything ins a single block).
Any ideas on how I might do this please?
Thanks in advance :)
I have a page structure something like this...
Rock gods (this page has the page list on it)
- Guitarists
-- Jimi Hendrix
-- Van Halen
- Bassists
-- Flea
-- Steve Harris
I'm using a page list with the "Include all child pages" checked to bring all the pages into a single page list.
The order now goes somewhat randomly, back and forward between the sections...
Jimi Hendrix, Flea, Van Halen, Steve Harris
It seems to order them as "Guitar, Bass, Guitar, Bass" and so on. What I really want it to do is "Guitar, Guitar, Bass, Bass".
In other words I need it to list all the sub-pages from the first child, then all the sub-pages from the next child.
The way this is implemented it's not an option to use 2 Page lists (I have a custom template that needs everything ins a single block).
Any ideas on how I might do this please?
Thanks in advance :)
In order to straighten this all out, you'd need to get the parent id of each page and figure out the page order of the parents, then stick the sub-pages in order inside each parent (like in your own array that you construct in php code after you've retrieved the list of pages). If you know you will only have 1 or 2 levels, this shouldn't be too difficult. But if you might have a variable number of levels then it gets real tricky.
You might want to use the autonav block instead in this case, since it will put the returned pages in the proper order (all pages in one section before moving on to the pages of another section).