Skip to content

Kirby 6.0.0

$page->isAncestorOf()

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

$page->isAncestorOf(Page $child): bool

Parameters

Name Type Default
$childrequired Kirby\Cms\Page no default value

Return type

bool

Parent class

Kirby\Cms\Page

Examples

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