Reference

Guide

$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 Description
$collection Kirby\Cms\Collection|null null

Return type

Kirby\Cms\Page|null

Example

<?php if($next = $page->nextUnlisted()): ?>
<a href="<?= $next->url() ?>">next unlisted page</a>
<?php endif ?>

Using sort field

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

Source code

kirby/src/Cms/PageSiblings.php#L87