• I am designing a new theme at the moment and am trying to use wp_nav_menu to create a menu of pages that is two levels deep. Here’s my code:

    <?php wp_nav_menu( array( 'container' => false, 'menu_id' => 'nav', 'theme_location' => 'primary', 'fallback_cb' => 'bp_dtheme_main_nav', 'depth' => 2 ) ); ?>

    I added ‘depth’ => 2 as per the instructions in the codex but it has no effect – it continues to allow to to navigate beyond the second level in my menu,

    Can anyone see what is wrong here?

Viewing 1 replies (of 1 total)
  • Thread Starter notpoppy

    (@notpoppy)

    Ah – figured it out. This is because ‘fallback_cb’ => ‘bp_dtheme_main_nav’ (added by Buddypress) sets the depth at 0 in the theme’s functions.php. I re-defined it in my theme’s functions.php and now it works as desired.

    Resolved.

Viewing 1 replies (of 1 total)
  • The topic ‘wp_nav_menu 'depth' argument won't work’ is closed to new replies.