WP Foundation ( 320press / Zurb )

Knowledgebase Docs » UberMenu 2 » Theme Integration

UberMenu won’t work at all with WP Foundation out of the box because WP Foundation strips out core menu item classes, which is something a theme should never ever do.

Since the menu classes are no longer present, UberMenu is unable to style the menu. To fix this, we need to stop Foundation from stripping these classes.

Here is the offending code in wp-foundation/functions.php

// change the standard class that wordpress puts on the active menu item in the nav bar
//Deletes all CSS classes and id's, except for those listed in the array below
function custom_wp_nav_menu($var) {
        return is_array($var) ? array_intersect($var, array(
                //List of allowed menu classes
        ) : '';
add_filter('nav_menu_css_class', 'custom_wp_nav_menu');
add_filter('nav_menu_item_id', 'custom_wp_nav_menu');
add_filter('page_css_class', 'custom_wp_nav_menu');
//Replaces "current-menu-item" with "active"
function current_to_active($text){
        $replace = array(
                //List of menu item classes that should be changed to "active"
                'current_page_item' => 'active',
                'current_page_parent' => 'active',
                'current_page_ancestor' => 'active',
        $text = str_replace(array_keys($replace), $replace, $text);
                return $text;
add_filter ('wp_nav_menu','current_to_active');
//Deletes empty classes and removes the sub menu class
function strip_empty_classes($menu) {
    $menu = preg_replace('/ class=""| class="sub-menu"/','',$menu);
    return $menu;
add_filter ('wp_nav_menu','strip_empty_classes');

To resolve this, we’ll add the following code to our child theme’s functions.php

add_action( 'init' , 'ubermenu_fix_foundations_bad_practices' );
function ubermenu_fix_foundations_bad_practices(){
	remove_filter('nav_menu_css_class', 'custom_wp_nav_menu');
	remove_filter('nav_menu_item_id', 'custom_wp_nav_menu');
	remove_filter('page_css_class', 'custom_wp_nav_menu');

I’ve created a sample child theme that includes this code, so you can just install it if you like

Download Foundation Child Theme