List sibling pages not working
-
I need to create a list of *sibling only* pages for some sub-pages, and have tried a number of methods (using wp_list_pages), but none are working.
I can quickly and accurately retrieve and display the Parent Page ID using echo $post-post_parent.
However when I try to get the child pages of that parent page (the current page’s siblings) like this:
$siblings = wp_list_pages(array( 'child_of' => $post->post_parent, 'echo' => 0 ) ); if ($siblings) { echo $siblings; }
I get nothing. I do have sibling pages, just can’t get them to be listed.
I’ve tried this, even simpler:
wp_list_pages("title_li=&child_of=".$post->post_parent."");
Still not working.
I haven’t had any trouble in creating loops showing all child pages of parent pages elsewhere, it’s just this sibling pages list I’m struggling with.
Any ideas? I’m on WP 4.3.1
- The topic ‘List sibling pages not working’ is closed to new replies.