Advertisement
demssite

Untitled

Sep 9th, 2011
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.59 KB | None | 0 0
  1. <?php
  2. $pagelist = get_pages('sort_column=menu_order&amp;sort_order=asc&amp;child_of='.$post->post_parent);
  3. $pages = array();
  4.  
  5. foreach ($pagelist as $page) {
  6.        $pages[] += $page->ID;
  7. }
  8. $current = array_search($post->ID, $pages);
  9. $prevID = $pages[$current-1];
  10. $nextID = $pages[$current+1];
  11.  
  12. if (!empty($prevID)) { ?>
  13.        <a href="<?php echo get_permalink($prevID); ?>" title="<?php echo get_the_title($prevID); ?>">Previous</a>
  14. <?php } if (!empty($nextID)) { ?>
  15.        <a href="<?php echo get_permalink($nextID); ?>" title="<?php echo get_the_title($nextID); ?>">Next</a>
  16. <?php }
  17. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement