Skip to content

Kirby 4.5.0

$page->find()

Finds one or multiple published children by ID

$page->find(array|string ...$arguments = null): Kirby\Cms\Page|Kirby\Cms\Pages|null

Parameters

Name Type Default
... $arguments array|string null

Return type

Kirby\Cms\Page|Kirby\Cms\Pages|null

Parent class

Kirby\Cms\Page

Example

Fetch a single subpage

<?= $page->find('subpage-a')->title() ?>

Fetch multiple subpages

<ul>
  <?php foreach($page->find('subpage-a', 'subpage-c', 'subpage-i') as $subpage): ?>
  <li>
    <a href="<?= $subpage->url() ?>">
      <?= html($subpage->title()) ?>
    </a>
  </li>
  <?php endforeach ?>
</ul>