Skip to content

$page->isAncestorOf()

Checks if the page is a direct or indirect ancestor of the given $page object

$page->isAncestorOf(Kirby\Cms\Page $child): bool

Parameters

Name Type Default
$child * Kirby\Cms\Page

Return type

bool

Parent class

Kirby\Cms\Page

Example

<?php if($page->isAncestorOf('some-child-page')): ?>
This page is an ancestor of the given page.
<?php endif ?>