Skip to content

Kirby 5.1.1

$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
$childrequired Kirby\Cms\Page no default value

Return type

bool

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

Parent class

Kirby\Cms\Page

Examples

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