Skip to content

Kirby 4.4.1

$page->parents()

Returns a list of all parents and their parents recursively

$page->parents(): Kirby\Cms\Pages

Return type

Kirby\Cms\Pages

Parent class

Kirby\Cms\Page

Example

<?php
$parents = $page->parents();
foreach($parents as $parent): ?>
  <h1><?= $parent->title()->html() ?></h1>
<?php endforeach ?>