Reference

Guide

$page->isDescendantOf()

Checks if the page is a descendant of the given page

$page->isDescendantOf(\Kirby\Cms\Page|string $parent): bool

Parameters

Name Type Default Description
$parent Kirby\Cms\Page|string

Return type

bool

Example

<?php if($page->isDescendantOf('some-page')): ?>
This page is a descendant of the given page.
<?php endif ?>

Source code

kirby/src/Cms/Page.php#L638