Skip to content

Kirby 3.9.8

$page->prevUnlisted()

Returns the previous unlisted page

$page->prevUnlisted(\Kirby\Cms\Collection|null $collection = null): Kirby\Cms\Page|null

Parameters

Name Type Default
$collection Kirby\Cms\Collection|null null

Return type

Kirby\Cms\Page|null

Parent class

Kirby\Cms\Page

Example

<?php if($prev = $page->prevUnlisted()): ?>
<a href="<?= $prev->url() ?>">previous unlisted page</a>
<?php endif ?>

With collection as argument

<?php
$collection = $page->siblings()->unlisted()->sortBy('date', 'desc');
if($prev = $page->prevUnlisted($collection)): ?>
<a href="<?= $prev->url() ?>">previous unlisted page</a>
<?php endif ?>