Skip to content

Kirby 5.1.1

$page->parents()

Returns a list of all parents and their parents recursively

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

Return type

Kirby\Cms\Pages

This method modifies the existing $page object it is applied to and returns it again.

Parent class

Kirby\Cms\Page

Examples

$parents = $page->parents();

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