Creation of sub menu

Hey I’m working with the plain kit and try to make a menu for the subfolders of my Chapters folder:

        <?php foreach ($site->children()->listed() as $item): ?>
        <li><a href="<?= $item->url() ?>"><?= $item->title() ?></a></li>
        <?php endforeach ?>

Right now it is only fetching the Chapters folder instead its subfolders…

Thank you in advance!

$site->children() fetches the children of the site object, i.e. all folders directly under content. You get the children of chapters with:

$children = page('chapters')->children()->listed();
1 Like

Thank you very much!
It seems to work smooth :smiling_face_with_three_hearts: