Display all pages of subpages in a loop

Hi I have this file structure:

Menu
     Menu-Catergory-1
          Menu-Item-1
          Menu-Item-2
     Menu-Category-2
          Menu-Item-1
          ...
      ...

So far I can only display all pages under the main page (Menu) using the loop in the Projects template included in the starter kit. I want to add another loop inside the first loop to display all menu-items under each menu-category.

Please can anyone link me to an article or samples I can read on.
Thank.s

This would be it I guess: https://getkirby.com/docs/solutions/menus#nested-menu

If you only want the children of the children you can use $page->grandChildren().

Ok, I think I wasn’t clear about the Menu. It’s not actually a menu navigation. I named it menu as I’m working on a restaurant website. This page Menu is where all the menu items are listed and categorized. Maybe there’s a better way of structuring it. Basically I have a main page called MENU, then under it will be categories like main dishes, drinks, etc, and under these categories will be the items. I’m trying to set it up via panel so client can easily add categories and items.

Thanks anyway.

<?php foreach ($menucategories = $page->children()->visible() as $menucategory): ?>
    <?= $menucategory->title()->h() ?>

    <?php foreach ($menuitems = $menucategory->children()->visible() as $menuitem): ?>
        - <?= $menuitem->title()->h() ?>
    <?php endforeach ?>
<?php endforeach ?>
1 Like