My wordpress blog contains the following Page hierarchy:
- page 1
L page 1.1
L page 1.2
- page 2
- page 3
I display a menu on my page.php template so that i can show a parent's child items, and a child's upper parent level, like this:
if($post->post_parent){
$page = get_page($post->post_parent);
$categoryTitle = $page->post_title;
$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");
}
Now there was a need recently to add an additional sublevel of pages, thus turning the system into:
- page 1
L page 1.1
L page 1.1.1
L page 1.1.2
L page 1.2
L page 1.2.1
- page 2
- page 3
Problem is: if i'm on a page x.x.1 i don't see page x in the menu, only the x.x parent.
Anyone has an idea on how to get all parents and children of a page ?