This seems like it should be easy to do, but I've not been able to find or work out a solution.
I'm using the Starkers theme and Wordpress 3.0.4, and my site auto-generates its navigation as per normal. I would like however the navigation to only show the top level pages, i.e. not display links to any pages that are children of other pages.
This is the code I am currently using.
<?php wp_nav_menu( array( 'container' => 'nav', 'fallback_cb' => 'starkers_menu',
'theme_location' => 'primary' ) ); ?>
I would like to hide the child links programmatically, but I am prepared to use CSS if someone can instead advise how to assign specific classes to the child links.
Thanks in advance for any help.
**edit 2**
I've tracked down the actual function I am using, called starkers_menu (below). However adding depth to this, or even removing the other exclusions and just using depth doesn't work either:
function starkers_menu() {
echo '<nav><ul>';
wp_list_pages('depth=1&exclude=4,19&title_li=');
echo '</ul></nav>';
}
'fallback_cb' => 'starkers_menu'
come from? I assume you use theme callled Starkers? I can't find such function or any calls to it there. – Rarst Jan 27 '11 at 14:56'fallback_cb' => 'starkers_menu'
does not exist in the most recent version of Starkers, so can only assume you're running an older version, can you track down that function? Perhaps add a copy of the function into the question.. – t31os Jan 27 '11 at 17:49