Toolset Bootstrap

To integrate UberMenu with Toolset Bootstrap, we’ll need to replace the default menu with UberMenu in order to strip out the residual styling, and stop the theme from removing the menu wrapper. I’ve provided a child theme at the end which accomplishes all of this.

First, replace the menu in header.php

<?php
if( wpbootstrap_get_setting('general_settings','display_header_nav') ):
	$wpbootstrap_navbar_classes = 'navbar';
	if ( of_get_option( 'navbar_style' ) === 'menu_static' ) {
		$wpbootstrap_navbar_classes = $wpbootstrap_navbar_classes . ' span12';
	} elseif ( of_get_option( 'navbar_style' ) === 'menu_fixed_top' ) {
		$wpbootstrap_navbar_classes = $wpbootstrap_navbar_classes . ' navbar-fixed-top';
	} elseif ( of_get_option( 'navbar_style' ) === 'menu_fixed_bottom' ) {
		$wpbootstrap_navbar_classes = $wpbootstrap_navbar_classes . ' navbar-fixed-bottom';
	}
	if ( of_get_option( 'navbar_inverted' ) ) {
		$wpbootstrap_navbar_classes = $wpbootstrap_navbar_classes . ' navbar-inverse';
	}
	include('_navbar.php');
endif;
?>

with UberMenu Direct:

<div class="ubernav span12">
	<?php if( function_exists( 'uberMenu_direct' ) ) uberMenu_direct( 'header-menu' ); ?>
</div>

We wrap it in a span12 to keep everything aligned

Now, the Toolset Bootstrap will strip out UberMenu’s wrapper in its `functions.php`, which breaks everything:

/*
 * Set default attributes for wp_nav_menu() function:
 * items_wrap => '<ul class="%2$s">%3$s</ul>',
 * dept => 3
 */
if (!function_exists('wpbootstrap_nav_menu_defaults')) {

    function wpbootstrap_nav_menu_defaults($args = '') {
        $nav_menu_args['container'] = false;

        if (!$args['items_wrap']) {
            $nav_menu_args['items_wrap'] = '<ul class="%2$s">%3$s</ul>';
        }

        if (current_theme_supports('bootstrap-top-navbar')) {
            $nav_menu_args['depth'] = 3;
        }

        if (!$args['walker']) {
            $nav_menu_args['walker'] = new Wpbootstrap_Nav_Walker();
        }

        return array_merge($args, $nav_menu_args);
    }

    add_filter('wp_nav_menu_args', 'wpbootstrap_nav_menu_defaults');
}

To resolve this, we add this to the child theme’s functions.php

add_action( 'init' , 'toolset_child_stop_removing_menu_container' );
function toolset_child_stop_removing_menu_container(){
	remove_filter('wp_nav_menu_args', 'wpbootstrap_nav_menu_defaults');
}

Finally, we recreate the spacing from the original theme.

.ubernav{
	margin-bottom:20px;
}

Here is the child theme that, once installed and activated, takes care of all of the above:

Download Toolset Bootstrap Child Theme

On this page