0

I imported a menu from my bootstrap to wordpress theme, at time of just static html, it showed and worked fine but when i used the wp_nav_menu, i don't have a 'text' or any indication to dropdown that menu, as its a dropdown menu. Am i missing something in the following code?

   wp_nav_menu( array(
        'menu'              => 'primary',
        'theme_location'    => 'primary',
        'depth'             => 3,
        'container'         => 'div',
        'container_class'   => 'collapse navbar-collapse',
        'container_id'      => 'bs-example-navbar-collapse-1',
        'menu_class'        => ' dropdown-menu',
      )
    );

as i would like to have a arrow to click to open dropdown.

Edit: I tried walker class, but i don't get a indicator of my dropdown and my styles in css just fails and i think walker class just overwrite it.

7
  • You need to define a custom menu walker. There are some of them already made for Bootstrap and freely available in Github, for example this one.
    – cybmeta
    Sep 2, 2015 at 14:12
  • @cybmeta yes i tried that. I edited the question to mention that. It completely break my layout like no more css works which i created and menu is opened, even if i do css to hidden until hover, it won't show a indicator which says menu to hover over to see dropdown.
    – localhost
    Sep 2, 2015 at 14:18
  • I don't know if the linked walker class is correctly coded, if it is correct for your Bootstrap version or if it conflicts with your CSS/HTML, it was just an example of what you have to do: define a custom walker menu class that fit your needs. There are other walket classes for bootstrap in Github, just search that site to see examples, there are lots of them.
    – cybmeta
    Sep 2, 2015 at 14:24
  • @cybmeta In view source, i cannot find wp_bootstrap_navwalker as its functions.php , should i be looking for something else, to find if it's included or not.
    – localhost
    Sep 2, 2015 at 14:35
  • 1
    I'm going to repeat myself: use a custom menu walker class that fit your needs. If you don't find one already made, make it yourself. I don't know what more to say. If you need help of how to create and use a custom menu walker class, explain where do you have the problem with it. This question and answer may help you to learn about extending menu walker class.
    – cybmeta
    Sep 2, 2015 at 15:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.