Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

At the moment I'm adding a button element around the menu anchors using this markup:

$defaults = array(
    'theme_location'  => '',
    'menu'            => 'main-nav',
    'container'       => 'ul',
    'container_class'    => 'nav navbar-nav',
    'before'          => '<button class="btn btn-warning">',
    'after'           => '</button>',
    'menu_class'      => '',
    'menu_id'         => 'menu',
    'echo'            => true,
    'fallback_cb'     => 'wp_page_menu',
    'link_before'     => '',
    'link_after'      => '',
    'items_wrap'      => '<div class="col-md-6 col-md-offset-3">%3$s</div>',
    'depth'           => 0,
    'walker'          => ''
);
wp_nav_menu( $defaults );

How would I add the btn btn-warning classes to the menu links automatically?

Here is an example of my site

share|improve this question
    
Why do you have to use a button element? You can have <a> elements that look like warning buttons in bootstrap –  Tom J Nowell Aug 13 at 15:22
    
Well, that's the thing... I can't specify a class for the <a> elements. and what I've tried does not work. Do you have any ideas? –  Kyle Poyser Aug 13 at 15:37
    
The site you linked to has button elements wrapped around anchor elements though? How is what you're trying to do different from what you already have? –  Tom J Nowell Aug 13 at 16:01
    
Because For some reason my current method (for the buttons) is not working in ie or Firefox... Test is out please my site –  Kyle Poyser Aug 13 at 19:16
    
I figure if the a link specifies a class="btn btn-warning" then i would not have to wrap the anchor element inside the <button></button>. –  Kyle Poyser Aug 13 at 19:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.