Skip to content

Kirby 4.1.2

$kirby->page()

Returns any page from the content folder

$kirby->page(?string $id = null, Kirby\Cms\Page|Kirby\Cms\Site|null $parent = null, bool $drafts = true): Kirby\Cms\Page|null

Parameters

Name Type Default
$id string|null null
$parent Kirby\Cms\Page|Kirby\Cms\Site|null null
$drafts bool true

Return type

Kirby\Cms\Page|null

Parent class

Kirby\Cms\App

Example

<?php

if ($p = $kirby->page('in-the-jungle-of-sumatra', page('notes'))) {
    echo 'Pages exists and has status ' . $p->status();
}

While the page() helper only finds published pages, $kirby->page() also finds drafts.