Skip to content

Kirby 3.8.4

$pages->find()

Find one or multiple elements by id

$pages->find(string $keys = null): mixed

Parameters

Name Type Default
$keys string null

Return type

mixed

Parent class

Kirby\Cms\Pages inherited from Kirby\Toolkit\Collection

Example

Fetch a single subpage

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

Fetch multiple subpages

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