I'm using wp_list_pages()
to display a menu of child pages.
The structure is nice and simple. Looks like this: http://cl.ly/image/0w1Q1q2D3D18
The menu works perfectly when on a child page: http://cl.ly/image/3O310E0s2B3d
But, alas, does not work when on the parent page: http://cl.ly/image/3w0T3Q2s4347
Seems so simple, but i just can't get to the bottom of it.
Here's my wp_list_pages()
code:
<?php
$topmost_parent = $post->post_parent;
$args = array(
'post_type' => 'guides',
'sort_column' => 'menu_order',
'title_li' => __(''),
'echo' => 0,
'exclude' => $topmost_parent
);
$children = wp_list_pages( $args );
if ($children) :
?>
<nav id="menu-context">
<ul class="menu">
<?php echo $children; ?>
</ul>
</nav>
<?php endif;?>
Using that $topmost_parent
trick works until I'm on the parent page. Anyone got a new trick? =)