Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author ImportWP

    (@jcollings)

    Cheers Joan,

    Just to clarify, you have created a menu and added dynamically populated items to the menu, and you wish to limit the depth of the dynamic menu items, or limit the depth of the whole menu to 1 level?

    James

    Thread Starter Joan Boluda

    (@boluda)

    Hi James!

    First of all, excuse my english, I’m from spain, and it’s not my mother language.

    I would like to choose the level of depth in the menu area, just as I can do it in the widget section. I would like to limit the depth to 1 level, not the menu items ??

    Thanks!

    Plugin Author ImportWP

    (@jcollings)

    Have a shot with this, i have not tried but in theory it should work.

    Goto your themes header file or where ever you wish to display the menu:

    $args = array(
    	'menu' => 'your-menu',	// the menu name
    	'walker' => new JC_Submenu_Nav_Walker(array(
    		'hierarchical' => 1,
    		'menu_start' => 0,	// set this to the depth you wish to start at
    		'menu_depth' => 5,	// set this to how many levels you require
    		'show_parent' => 0,
    		'split_menu' => true
    	))
    );
    
    wp_nav_menu( $args );
    Thread Starter Joan Boluda

    (@boluda)

    Hi James!

    Thanks for your help!. It’s not working. Is there anything I can change on the code, or using a hook?

    Thanks again!

    Thread Starter Joan Boluda

    (@boluda)

    Sorry, It worked, actually!

    Thanks, James!

    Plugin Author ImportWP

    (@jcollings)

    Anything change for it too start working?

    To display a certain depth of the menu you will be using the split/dynamic menu functionality. This works to display the relevant menu items relating to the current page.

    Cheers
    James

    Thread Starter Joan Boluda

    (@boluda)

    No, the snippet works fine just like that! ??

    Thanks!

    Plugin Author ImportWP

    (@jcollings)

    Thread Closed

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Change depth’ is closed to new replies.