Previously, I was able to selectively load child pages for a currently-selected parent page using logic such as:
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 id="subnav">
<?php echo $children; ?>
</ul>
<?php
} else {
}
There doesn’t seem to be a native way to do this using the new register_nav_menus()/wp_nav_menu() functionality. Anyone know how I could patch this together at this point?
Here’s a screenshot of what I’m trying to achieve:
I created a Widget named Page Sub Navigation (clever I know) that is working for me.
If you install this, you can just drag the widget to one of your widget areas and BAM it works.
Or if you just want the juicy parts…
UPDATE
I found another plugin that does essentially the same thing (and maybe does it better, I don’t know). http://wordpress.org/extend/plugins/subpages-widget/
you could do a css hack to do this (2 ways that I would try)
1 this is the easiest way I can think of do make the css display the items in the subnavigation.
2 assuming that your theme supports body classes you could create a nav menu for each “sub nav”, and set them to display beneath the main navigation – then edit your stylesheet to only show the subnav div’s using something like this:
1 this is the php display .
2 this is the css display .
CSS