froot Posted October 28, 2021 Share Posted October 28, 2021 This might be a very basic question, don't know what's the easiest solution though… Let's say I have some pagetree like that: beverages> whiskey > > Jameson > > Ardberg> beer > > Heineken > > Leffesweets> cake > > cheesecake > > chocolate> ice cream > > stracciatella > > raspberry I want an array of all these pages in order of appearance in the page tree. I tried: $homepage = $pages->get('/'); $items = $homepage->descendants("template=menu"); But when I loop through it foreach ($items as $item) { echo $item->title; } it first shows level 1, then level 2, then level 3 like this: beverages, sweets, whiskey, beer, cake, ice cream, Jameson, Ardberg, Heineken, Leffe, cheesecake, chocolate, straciatelly, raspberry Thanks for help! Link to comment Share on other sites More sharing options...
BillH Posted October 28, 2021 Share Posted October 28, 2021 You'll probably find what you need under "How to force pages to sort by their admin order with $pages->find()" on https://processwire.com/docs/selectors/ If that doesn't help, you may need to loop through the pages (or set up a sort field, but that'd most likely be greatly over complicated). 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now