Atahualpa takes the output of the menu and alters the markup with preg_replace in functions/bfa_new_wp3_menus.php
ob_start(); wp_nav_menu( array( 'theme_location' => $theme_location, 'container' => 'div', 'container_id' => $theme_location, 'menu_class' => $menu_class, 'menu_id' => $menu_id, 'link_before' => '<span>', 'link_after' => '</span>' ) ); $newmenu = ob_get_contents(); ob_end_clean(); $newmenu = preg_replace("/<li (.*?)class=\"(.*?)\">(.*?)\n(.*?)<ul class=\"/i","<li \\1 class=\"rMenu-expand \\2\">\\3\n\\4<ul class=\"rMenu-ver ",$newmenu); return $before_menu . $newmenu . $after_menu;
This means it’s going to completely break the UberMenu markup, and there is nothing UberMenu can do to prevent this (the theme should use a custom walker or an appropriate menu item filter, not string manipulation with preg_replace).
Page Menu Bar – “Menu1”
To use UberMenu with Atahualpa’s Page Menu Bar (this is assuming usage in the “menu1” position), first make sure you’ve assigned a menu to the Menu1 theme location. Then edit functions/bfa_header_config.php
and find this code around line 28
$page_menu_bar = bfa_new_wp3_menus("menu1", $alignment );
This is where Atahualpa generates the menu, and does some string replacement that causes the issue. Replace this line with UberMenu Manual Integration:
$page_menu_bar = ubermenu( 'main' , array( 'theme_location' => 'menu1' , 'echo' => false ) );
Category Menu Bar – “Menu2”
To use UberMenu with Atahualpa’s Category Menu Bar (this is assuming usage in the “menu2” position), first make sure you’ve assigned a menu to the Menu2 theme location. Then edit functions/bfa_header_config.php
and find this code around line 89
$cat_menu_bar = bfa_new_wp3_menus("menu2", $alignment );
This is where Atahualpa generates the menu. Replace this line with UberMenu Manual Integration:
$cat_menu_bar = ubermenu( 'main' , array( 'theme_location' => 'menu2' , 'echo' => false ) );
This will insert UberMenu instead.
Maintaining these changes
It is always recommended that you store your changes in a child theme. Unfortunately, there are no pluggable functions, hooks, or template files offered. If you want, you can copy header.php
into a child theme, then copy the bfa_header_config() function into the child theme as well (in the functions.php), rename it, and then use that function in place of the original in the child theme’s header.php. But if this function changes frequently with theme updates, it may be simpler to just make the adjustment in the main theme when updating.
The proper solution would be for the theme to not do a preg_replace on the menu output, in which case none of this would be necessary and things would just work out of the box. So the alternative is to comment out this line in functions/bfa_new_wp3_menus.php
:
$newmenu = preg_replace("/<li (.*?)class=\"(.*?)\">(.*?)\n(.*?)<ul class=\"/i","<li \\1 class=\"rMenu-expand \\2\">\\3\n\\4<ul class=\"rMenu-ver ",$newmenu);