I’m trying to get the page’s next and previous “brother”.
Here i am trying to make an array with all the page’s brothers (their IDs)
$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;
}
Then i search for the current page id in that array and i remember the position. That means that the previous array element is the id of the previous page, and the next element is the id of the next page.
$current = array_search($post->ID, $pages);
$prevID = $pages[$current-1];
$nextID = $pages[$current+1];
Based on those IDs i show the post title and permalink using get_the_title() and get_permalink(). This works fine. But when i try to display that page info using this:
<div class="post" id="post-<?php the_ID(); ?>">
<h2><?php the_title(); ?></h2>
<div class="entry">
<?php the_content('<p class="serif">Read the rest of this page »</p>'); ?>
<?php echo $post->post_content; ?>
<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
</div>
</div>
Everything shows ok except the_content() which returns a number.