Skip to content

Kirby 4.5.0

$page->nextUnlisted()

Returns the next unlisted page if it exists

$page->nextUnlisted(\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($next = $page->nextUnlisted()): ?>
<a href="<?= $next->url() ?>">next unlisted page</a>
<?php endif ?>

Pass a collection

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