Skip to content

Kirby 3.8.4

$site->grandChildren()

Returns a collection of all published children of published children

$site->grandChildren(): Kirby\Cms\Pages

Return type

Kirby\Cms\Pages

Parent class

Kirby\Cms\Site

Example structure

  • content
    • home
    • about
      • company
      • team
      • philosophy
    • projects
      • project-a
      • project-b
      • project-c

Example code

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

Result

The code above will give you a list like this:

  • Company
  • Team
  • Philosophy
  • Project A
  • Project B
  • Project C