Well I’ve been trying to get two-tier navigation working with flex-form for a client and I just can’t seem to work out how this php is working…
I’m using the code from here: http://www.darrenhoyt.com/2008/02/12/creating-two-tiered-conditional-navigation-in-wordpress/ as the base and just replacing the nav divs with said code^^. It doesn’t work as intended though :/ I was hoping I could get some help fixing it and I’d be glad to write up a blog post or something detailing how to get the same effect on any wordpress installation later. Anyway, I’ll explain the problem now.
Ignoring the obvious CSS styling that’s just missing/ugly, the functionality isn’t working. On a top-tier page it’s fine, shows the first titles and the direct children. Then if you go down one level it still works. Firstly I’d like the children of a second tier page to be shown in a drop-down :/ I’m unsure on how to add the sub-nav dropdown class to the ul/li tags within a php callback. Finally on a Third-Tier page the second-tier navigation starts showing third-tier and so forth. I’m really stumped.
You can look at the WIP here: http://hedag.ch/beta/
The flow to see what I mean would be Home –> Engineering –> Projekte –> (Link in the post) Fertigungstechnik, umformen
Also I broke the mini-navigation but I don’t really care about that tbh. I’m thankful for any help.
My Navigation Code:
<!--// OPEN CUSTOM SECTION //-->
<div id="main-navigation" class="menu-main-menu-container span9 clearfix">
<ul id="nav" class="menu">
<?php wp_list_pages('title_li=&depth=1&exclude=2'); ?>
</ul>
<?php if($post->post_parent)
$children = wp_list_pages("title_li=&child_of=
".$post->post_parent."&echo=0&depth=1");
else
$children = wp_list_pages("title_li=&child_of=
".$post->ID."&echo=0&depth=1");
if ($children && is_page()) { ?>
<ul id="subnav">
<?php echo $children; ?>
</ul>
<?php }
else { ?><?php } ?>
</div>
<!--// END CUSTOM SECTION //-->