How to display sister pages of current page

I’ve one menu with submenu in my site, when i press in one item of submenu i see one page, this page have a left sidebar with list of these submenu pages and highlightning current page that i see.

enter image description here

Read More

enter image description here

I tryed using wp_list_pages but, not work. Can i use WP_Query?

How do it?

Related posts

Leave a Reply

1 comment

  1. If what you want is to display only the siblings of the page you can try this.

    $parent = $post->post_parent;
    wp_list_pages(array(
    'depth'=>1, //displays only the top depth
    'exclude'=>$parent, //Exclude the parent page from showing up in the list.
    ));
    

    You’ll need to create some conditional statements for child pages to display their sibling pages,but this should at least get you going. By specifying which ID to include in the page list it should output a list for you.

    Also, you can refer to the wp_list_pages codex for detailed description on how it works 🙂

    EDIT: Tested the above and fixed an element that wasn’t working. It should now work to display only the sibling pages