wp_list_pages: list current top level page all siblings on ALL siblings
-
Hi —
Sorry, this must have been dealt with tons of times, but it’s hard to search forums for exactly what I want, and I’ve been fiddling with wp_list_pages for hours now. Any help much appreciated.
I have :
Top level page 1
–Child page 1.1
—-Grand child page 1.1.1
—-Grand child page 1.1.2
—-Grand child page 1.1.3
–Child page 1.2
—-Grand child page 1.2.1
—-Grand child page 1.2.2
—-Grand child page 1.2.3
—-Grand child page 1.2.4
Top level page 2
–Child page 2.1
—-Grand child page 2.1.1
etc.Regardless of where I am within a given top level page tree, I need to display the current top level page tree (and only this one) with all siblings.
I tried:
<?php if($post->post_parent) $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); else $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0"); if ($children) { ?> <ul> <?php echo $children; ?> </ul> <?php } ?>
…which works for top level and child pages, yet on grand child pages, I only see same level other grand child pages.
IOW:
Top level page 1 = OK (I see current top level + all sub levels)
–Child page 1.1 = OK (I see current top level + all sub levels)
—-Grand child page 1.1.1 = NOT OK as I only see 1.1.1 + 1.1.2 + 1.1.3, and not 1 and 1.1 (+child pages), 1.2 (+child pages) etc.THANKS!
- The topic ‘wp_list_pages: list current top level page all siblings on ALL siblings’ is closed to new replies.