Skip to content

Kirby 3.5.7.1

$site->find()

Finds one or multiple children by id

$site->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\Site

Example

Fetch a single subpage

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

Fetch multiple subpages

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