Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #396731

    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

    #397010

    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

    #397186

    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

    #397391

    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

    #397938

    Works perfectly.

    Thanks
    Mike

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Fullwidth submenu’ is closed to new replies.