Skip to content

Kirby 3.7.5

pages()

Helper to build pages collection

pages(string|array $id = null): Kirby\Cms\Pages|null

Parameters

Name Type Default
$id string|array null

Return type

Kirby\Cms\Pages|null

The pages() helper throws a deprecation warning if a single ID gets passed. Starting in 3.7.0 it will always return a Kirby\Cms\Pages collection. Use page() for a single page instead.

Example

<?php $collection = pages(['home', 'blog']) ?>
<?php $collection = pages([$page, $page->children()->first()]) ?>

The pages() helper fetches published pages only; ids of draft pages are ignored.