Wordpress | Custom Previous/Next posts
<?php
$pagelist = get_pages("child_of=".$post->post_parent."&parent=".$post->post_parent."&sort_column=menu_order&sort_order=asc");
$pages = array();
foreach ($pagelist as $page) {
$pages[] += $page->ID;
}
$current = array_search($post->ID, $pages);
$prevID = $pages[$current-1];
$nextID = $pages[$current+1];
if (!empty($prevID) || !empty($nextID)) { ?>
<div class="navigation-wrapper">
<div class="navigation">
<?php if (!empty($prevID)) { ?>
<div class="cell cell-previous">
<a href="<?php echo get_permalink($prevID); ?>" title="<?php echo get_the_title($prevID); ?>">
Précédent<br>
<strong><?php echo get_the_title($prevID); ?></strong>
</a>
</div>
<?php } ?>
<?php if (!empty($nextID)) { ?>
<div class="cell cell-next">
<a href="<?php echo get_permalink($nextID); ?>" title="<?php echo get_the_title($nextID); ?>">
Suivant<br>
<strong><?php echo get_the_title($nextID); ?></strong>
</a>
</div>
<?php } ?>
</div>
</div>