Menu go to next child or previous


I have a list of pages and I’m looking for a way to create a menu to go to the next child in the list or the previous one when visiting a specific page.

Is there anyway to do this?

Appreciate help

You can use the prev()and next() methods:

<nav class="switch-page">
if($page->hasPrev()) : ?>
  <a href="<?php echo $page->prev()->url() ?>">Previous Page</a>
<?php endif ?>
<?php if($page->hasNext()): ?> 
  <a href="<?php echo $page->next()->url() ?>">Next Page</a>
<?php  endif; ?>

works like a charm.

texnixe I feel like I have to wire money to you soon.

appreciate it.