$page->nextListed()
Returns the next listed page if it exists
$page->nextListed(Kirby\Cms\Pages|null $collection = null): Kirby\Cms\Page|null
Parameters
| Name | Type | Default |
|---|---|---|
| $collection | Kirby\Cms\Pagesornull |
null
|
Return types
Kirby\Cms\Pageornull
This method modifies the existing $page object it is applied to and returns it again.
Parent class
Examples
<?php if ($next = $page->nextListed()): ?>
<a href="<?= $next->url() ?>">next listed page</a>
<?php endif ?>
Pass a collection
<?php
$collection = $page->siblings()->listed()->sortBy('date', 'desc');
if ($next = $page->nextListed($collection)): ?>
<a href="<?= $next->url() ?>">next listed page</a>
<?php endif ?>