Hi all,

I have been asked to set up a wordpress site, and are finding it hard to find in the documentation how I can do the folllowing:

A main link is clicked, and only then I want to show the children underneath, if there is any.

Further if a child link is clicked, I want to show the children underneath, if any.. So recursively displaying children.

Im not interested in showing the entire tree at one time, only the children, when a parent is clicked.

I have this small bit of code, showing the main menu (Stacked on top of each other in a left bar on the site)

<div id="sidebar_main_nav">
<?php
// Main navigation
$defaults = array(
    'container'       => 'div',
    'container_class' => '',
    'container_id'    => '',
    'echo'            => true, 
    'fallback_cb'     => 'wp_page_menu',
    'theme_location'  => 'primary',
    'menu_class'      => 'main_nav',
    'menu_id'         => '',
    'link_before'     => '',
    'depth'           => 1);

wp_nav_menu( $defaults );
?>

</div>

This spits out the main links.

I guess I need to loop some native wordpress functions in some way?

Any help appreciated,

Regards, Klemme

I think what you wish to achieve is not posible without a little help of CSS + javascript. With the help of those 2, you can probably show all and add/remove a 'hidden' css class to the div containing submenu while the hidden css class will having the CSS styling to hide the submenu div.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.