Reference

Guide

$page->nextUnlisted()

Returns the next unlisted page if it exists

$page->nextUnlisted(): Kirby\Cms\Page|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#L120