0

On my WP site, I want to create a menu which includes sub-menus inside a dropdown.

I structured my menu to be like this: enter image description here

From what I have seen from several WP tutorials on the web. It is expected that the three sub-items will be inside the dropdown of "Products". However that is not the case with my site:

enter image description here

Here is the code I use in my template to generate the Nav bar:

<header class="primary-header">
  <a <?php
    if(!is_page('Body Strap') && !is_page('The Metronome') && !is_page('Soundbrenner Pulse Home')  && !is_page('DAW Tools')  && !is_page('Artists')&& !is_page('Vibration') ){
    echo 'class="logo logo-black"';
    }
    else {
    echo 'class="logo logo-white"';
    }?> href=<?php echo get_home_url().'/'?>>
    <span>Soundbrenner Pulse</span>
  </a>
  <button class="open-mobile-menu">Trigger</button>
  <?php wp_nav_menu( array(
  'menu' => 'MainMenu-Theme2',
  'theme_location' => 'primary',
  'container' => 'nav',
  'menu_class' => false
  ) ); ?>
</header>

How to hide the three sub-menus into dropdown menu of "Products" ?

  • 1
    edit your question to show us the code you use to generate the menu. – mmm Jan 10 '18 at 17:02
  • add depth in your wp_nav_menu array – DHL17 Jan 11 '18 at 6:59
0

I think you forgot to set the menu location. Below the menu (depending on the used theme) - right below that what your image shows are one or more checkboxes "Location in the theme". Select the "primary" menu

If no menu location is selected, the fallback is to show every page in hierarchical order from left to right. I think this is what happens here.

0

Or this may be the issue with bootstrap navigation link: check this out: https://github.com/wp-bootstrap/wp-bootstrap-navwalker There you will get good information about how to fix the navigation link that are not being correctly displayed in the theme. Hope it helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.