0

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

Edited by klemme

2
Contributors
1
Reply
12
Views
2 Years
Discussion Span
Last Post by lps
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.