Return to Snippet

Revision: 26509
at April 29, 2010 14:23 by Overdeath


Initial Code
<?
if (!empty($post->post_parent)) {
$pagelist = get_pages("child_of=".$post->post_parent."&parent=".$post->post_parent."&sort_column=menu_order&sort_order=asc");
$pagini = array();
foreach ($pagelist as $pagina) {
   $pagini[] += $pagina->ID;
 
}  
}

$current = array_search($post->ID, $pagini);
$prevID = $pagini[$current-1];
$nextID = $pagini[$current+1];
?>
<div class="navigation">
<?php if (!empty($post->post_parent)) { ?>
<div style="clear:both;"><a href="<?php echo get_permalink($post->post_parent); ?>"
  title="<?php echo get_the_title($post->post_parent); ?>"> <?php echo get_the_title($post->post_parent); ?></a></div>  
<?php  } if (!empty($prevID)) { ?>
<div class="alignleft">
<a href="<?php echo get_permalink($prevID); ?>"
  title="<?php echo get_the_title($prevID); ?>">&laquo; <?php echo get_the_title($prevID); ?></a>
</div>

<?php }
if (!empty($nextID)) { ?>
<div class="alignright">
<a href="<?php echo get_permalink($nextID); ?>" 
 title="<?php echo get_the_title($nextID); ?>"><?php echo get_the_title($nextID); ?> &raquo;</a>
</div>
<?php } ?>
</div>

Initial URL


Initial Description
Must be placed after the_post()

Initial Title
Wordpress - Show link to the next and previos brother of the current page, and a link to the page parent

Initial Tags
page, wordpress

Initial Language
PHP