I am using WordPress as Content management systems for any site I am developing. When I am browsing posts, I'm able to use Next/Previous links just to walk between posts. I wish to have a similar factor on pages.

  • Page A
  • Page B
  • Page C

Page A should connect to next brother or sister Page B. Page B should connect to previous brother or sister Page A and then brother or sister Page C. Page C should connect to previous brother or sister Page B.

Can there be any wordpress plugin you are able to suggest that creates these links? I understand you will find some plug ins which do this, however i particularly have to have one that hooks into my current theme instantly. I understand how to edit the theme, but that will brick my website each time a theme update can be obtained.

I am while using LightWord WordPress theme.

Pop the next code to your functions.php file inside your active theme directory:

function siblings($link) {
    global $post;
    $siblings = get_pages('child_of='.$post->post_parent.'&parent='.$post->post_parent);
    foreach ($siblings as $key=>$sibling){
        if ($post->ID == $sibling->ID){
            $ID = $key;
    $closest = array('before'=>get_permalink($siblings[$ID-1]->ID),'after'=>get_permalink($siblings[$ID+1]->ID));

    if ($link == 'before' || $link == 'after') { echo $closest[$link]; } else { return $closest; }

To call the function:

<?php siblings('before'); ?>


<?php siblings('after'); ?>

and it'll echo the connect to the prior or next page.

If you would like both you are able to leave the function empty and it'll return an assortment with both links.