Good morning,
I’m adding a fullwidth submenu to a page and would like it to display the name of the menu instead of the title ‘menu’ only when it is displayed on mobile size screen. Is this possible?
Thanks
Mike
Hey msmazza!
Open up /enfold/config-templatebuilder/avia-shortcodes/menu.php and around line 186 you should see this.
$mobile_button = $mobile == "active" ? "<a href='#' class='mobile_menu_toggle' ".av_icon_string('mobile_menu')."><span class='av-current-placeholder'>".__('Menu', 'avia_framework')."</span>" : "";
Change it to this.
$nav_menu = wp_get_nav_menu_object($menu);
$mobile_button = $mobile == "active" ? "<a href='#' class='mobile_menu_toggle' ".av_icon_string('mobile_menu')."><span class='av-current-placeholder'>".__($nav_menu->name, 'avia_framework')."</span>" : "";
Cheers!
Elliott
Thanks Elliot. Works perfectly. Can you think of any way I can make this update to a child theme so that I won’t lose the changes when there is a theme update?
Mike
Hey!
Add this code to the child theme’s functions.php:
add_filter('avia_load_shortcodes', 'avia_include_shortcode_template', 15, 1);
function avia_include_shortcode_template($paths)
{
$template_url = get_stylesheet_directory();
array_unshift($paths, $template_url.'/shortcodes/');
return $paths;
}
Create a folder called “shortcodes”. Copy the modified menu.php file inside.
Best regards,
Ismael
Works perfectly.
Thanks
Mike