Skip to content

Kirby 3.9.8

$site->find()

Finds one or multiple published 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>