i want to add next and previous page links within the same level.
I found a solution for all pages (child and parent) in the WordPress codex: https://codex.wordpress.org/Next_and_Previous_Links#The_Next_and_Previous_Pages
But what i want, is a navigation within the same level.
Any ideas how to solve this?
EDIT:
<?php
$pagelist = get_pages('post_type=publikation&sort_column=menu_order&sort_order=asc');
$pages = array();
foreach ($pagelist as $page) {
$pages[] += $page->ID;
}
$current = array_search(get_the_ID(), $pages);
$testPost = (get_pages( array( 'post_type' => 'publikation' ,'child_of' => $post->ID ) ) || $post->post_parent);
$prevID = $pages[$current-1];
$nextID = $pages[$current+1];
?>
<div class="navigation">
<?php if (!empty($prevID) && !$testPost) { ?>
<div class="alignleft">
<a href="<?php echo get_permalink($prevID); ?>"
title="<?php echo get_the_title($prevID); ?>">Previous</a>
</div>
<?php }
if (!empty($nextID) && !$testPost) { ?>
<div class="alignright">
<a href="<?php echo get_permalink($nextID); ?>"
title="<?php echo get_the_title($nextID); ?>">Next</a>
</div>
<?php } ?>
</div><!-- .navigation -->`