Skip to content

Kirby 5.1.1

$site->childrenAndDrafts()

Returns all published and draft children at the same time

$site->childrenAndDrafts(): Kirby\Cms\Pages

Return type

Kirby\Cms\Pages

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

Parent class

Kirby\Cms\Site

Examples

<?php foreach ($site->childrenAndDrafts() as $item) {
   if ($item->isDraft()) {
       echo $item->title() . ' is a draft';
   }

    echo $item->title() . ' is a published page';
}