I'm trying to hack together a more efficient (fewer db calls etc) function than WordPress' wp_list_pages without all the possible arguments and stuff. The wp_posts table looks like this:
ID post_title post_parent
1 Skate brand no1 5
2 Skate brand no2 5
3 Products 0
4 Bikes 3
5 Skateboards 3
6 About 0
7 Contact 6
8 Surfboards 3
And I want an array that looks like this:
array
1 => Products
array
1 => Bikes
2 => Skateboards
array
1 => Skate brand no1
2 => Skate brand no2
3 => Surfboards
2 => About
array
1 => Contact
How should I approach this task?
UPDATE!
By replacing about 4 or 5 wp_list_pages on the front page of my site with the code provided by @Gedrox the daily average response time went from a shaky 780-1000ms down to a stable 595-625ms. Amazing!