Skip to content

Kirby 5.1.1

$site->hasListedChildren()

Checks if the page has any listed children

$site->hasListedChildren(): bool

Return type

bool

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

Parent class

Kirby\Cms\Site

Examples

<?php if ($site->hasListedChildren()): ?>
    <nav>
    <?php foreach ($site->children()->listed() as $child): ?>
        <a href="<?= $child->url() ?>"><?= $child->title() ?></a>
    <?php endforeach ?>
    </nav>
<?php endif ?>