Skip to content

Kirby 5.0.4

$page->find()

Finds one or multiple published children by ID

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

Parameters

Name Type Default
...$arguments arrayorstring no default value

Return types

Kirby\Cms\PageorKirby\Cms\Pagesornull

This method modifies the existing $page object it is applied to and returns it again.

Parent class

Kirby\Cms\Page

Examples

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>