Here is a link to my website: website
I have placed the following code to this document in /wp-includes/nav-menu-template.php
Towards the end of the code are several lines that start with $item_output. In particular, you want to look at this piece:
$item_output .= '<a'. $attributes .'>';
Because this line determines the output for the beginning of the link html. I have changed it to something like this:
$item_output .= '<a'. $attributes . 'class="btn btn-warning btn-block"' .'>';
Then all your links in the menu will have class="btn btn-warning btn-block" added to them.
That said, it doesn't allow a custom class for each menu and I several menus that don't need the class="btn btn-warning btn-block" inside of the a link. (or at least I don't know how to code it). This is an issue for me.
Does anyone know how to code this request?
For those asking why would you want to do this? I want to have my main (top) menu links to be buttons.
Here is the function I'm using to call the menu:
<!--buttons--> <?php $defaults = array( 'theme_location' => '', 'menu' => 'main-nav', 'container' => 'ul', 'container_class' => 'nav navbar-nav', 'before' => '', 'after' => '', '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 ); ?>