Skip to content

Kirby 3.9.8

$page->hasNextListed()

Checks if there's a next listed page in the siblings collection

$page->hasNextListed(\Kirby\Cms\Collection|null $collection = null): bool

Parameters

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

Return type

bool

Parent class

Kirby\Cms\Page

Example

<?php
if ($page->hasNextListed()) {
  echo $page->nextListed()->url();
}
?>

With collection as argument

<?php
$collection = $page->siblings()->listed()->sortBy('date', 'desc');
if ($page->hasNextListed($collection)) {
  echo $page->nextListed($collection)->url();
}
?>