Skip to content

Kirby 3.7.5

$page->find()

Finds one or multiple published children by ID

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

Parameters

Name Type Default
$arguments 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>