What I have is a very deep menu structure in WordPress, 5 levels deep in some pages. What I need is a menu for every parent above the current page. So for example if I am here:
Main / Sub / SubSub / SubSubSub I want to see, above each other:
- Menu for all main items
- Menu for all items in Sub
- Menu for all items in SubSub, including SubSubSub
I am using the wp_list_pages function like this:
<?php
if ( $post->post_parent ) {
$args = array(
'child_of' => $post->ID,
'depth' => 1,
'sort_column' => 'post_date',
'sort_order' => 'DESC',
'title_li' => ''
);
echo '<nav id="subnav"><ul>';
wp_list_pages( $args );
echo '</ul></nav>';
} ?>
But I cannot tell if I am at lvl 2 or below. I found the ancestor menu (always shown) with this bit:
'child_of' => get_post_top_ancestor_id()
But I cannot get it to list one menu for every other parent that is not the topmost ancestor. I tried modifying this code here:
https://wordpress.stackexchange.com/questions/15141/list-wordpress-custom-menus-active-parent-levels-children-as-separate-menu
and looping through all parents like here:
http://wordpress.org/support/topic/get-and-display-parent-pages-of-a-menu
Main problem is I am not much of a PHP programmer so creating my own functions is not really an option. Any help is much appreciated
Almost there, I still nee to loop through $howdeep > 2 and find the correct level to show… If someone knows how to do it…