Reference

Guide

$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 Description
$child Kirby\Cms\Page

Return type

bool

Example

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

Source code

kirby/src/Cms/Page.php#L558