$page->prevVisible([$sort, $direction])

Returns the previous visible sibling

  • $sort (string)
    An optional sort field for the siblings
  • $direction (string)
    An optional sort direction
  • return ($page)

Example

<?php if($prev = $page->prevVisible()): ?>
<a href="<?= $prev->url() ?>">previous visible page</a>
<?php endif ?>

Using sort field

<?php if($prev = $page->prevVisible('date', 'desc')): ?>
<a href="<?= $prev->url() ?>">previous visible page</a>
<?php endif ?>

Is something missing or incorrect? Edit this page on Github…