Karma

Knowledgebase Docs » UberMenu 2 » Theme Integration
USEFUL? 0

Are you using UberMenu 3? Please check out the UberMenu Karma Integration Guide

UberMenu integrates well with Karma except when it comes to templates with additional menus. If you use a template like Left Nav + Sidebar, you’ll find that both the header nav menu and the sidebar nav menu become UberMenus.

The issue arises because Karma defines both menus as the same menu theme location. That is, both the menu in the header and the menu in the sidebar are defined as “Primary Navigation” by Karma. As a result, there is no distinction to be made between the two menus (they are really the same menu, printed twice), so you end up with two UberMenus.

/* Karma/header.php line 76-80 */
 
<?php if(has_nav_menu('Primary Navigation')): ?>
<ul id="menu-main-nav">
<?php wp_nav_menu(array('theme_location' => 'Primary Navigation' , 'depth' => 0 , 'container' =>false , 'walker' => new description_walker() )); ?>
</ul>
<?php endif; ?>
 
 
/* Reformatted here for visualization */
wp_nav_menu( array(
 'container' =>false,
 'theme_location' => 'Primary Navigation',       //PROBLEM
 'depth' => 0,
 'walker' => new description_walker())
 );
}
 
/****************************************************/
 
/* Sidebar - Karma/functions/global/subnav-left.php line 2*/
$menu_code = wp_nav_menu( array(
 'container' =>false,
 'theme_location' => 'Primary Navigation',       //PROBLEM
 'sort_column' => 'menu_order',
 'menu_class' => '',
 'echo' => false,
 'before' => '',
 'after' => '',
 'link_before' => '',
 'link_after' => '',
 'depth' => 0,
 'walker' => new sub_nav_walker())
 );

The solution is to define a menu theme location for each real menu location within the templates (header, nav, etc). Really, we just want to make sure that the header menu is an UberMenu and nothing else. So the simplest solution is to use UberMenu Easy Integration for the header menu. This will automatically define a new theme location called “UberMenu”. Switch it on in Appearance > UberMenu > Theme Integration > Easy Integration, then add the appropriate code:

/* Replace the entire menu section call in header.php line 76-80 with uberMenu_easyIntegrate() */
 
/* Remove this: */
<?php if(has_nav_menu('Primary Navigation')): ?>
<ul id="menu-main-nav">
<?php wp_nav_menu(array('theme_location' => 'Primary Navigation' , 'depth' => 0 , 'container' =>false , 'walker' => new description_walker() )); ?>
</ul>
<?php endif; ?>
 
 
/* Add this: */
<?php uberMenu_easyIntegrate(); ?>

Once you’ve done that, just go to Appearance > Menus and set the appropriate menu for the UberMenu location, and activate that location (deactivate the others). You can set whatever menu you want for the Primary Navigation location, which will now be used for things like sidebars (you can use the same menu here, it’ll just be printed normally rather than as an UberMenu.

So now,

  • UberMenu (location) = header menu
  • Primary Navigation = other menus