Home Forums WoodMart support forum a problem with the widget Reply To: a problem with the widget

#187818

Artem Temos
Keymaster

Try to add the following PHP code snippet to the child theme functions.php file to fix this

function woodmart_mobile_menu() {
    $menu_locations = get_nav_menu_locations();
    $location = apply_filters( 'woodmart_main_menu_location', 'main-menu' );
    $menu_link = get_admin_url( null, 'nav-menus.php' );
    $search_args = array();
    $search_form = true;
    $settings = whb_get_settings();
    $toolbar_fields = woodmart_get_opt( 'sticky_toolbar_fields' );
    if( isset( $settings['search'] ) ) {
        $search_args['post_type'] = $settings['search']['post_type'];
        $search_args['ajax'] = $settings['search']['ajax'];
    }
    if( isset( $settings['burger'] ) || in_array( 'mobile', $toolbar_fields ) || in_array( 'search_args', $toolbar_fields ) ) {
        $mobile_categories = isset( $settings['burger']['categories_menu'] ) ? $settings['burger']['categories_menu'] : false;
        $search_form = isset( $settings['burger']['search_form'] ) ? $settings['burger']['search_form'] : true;
        $position = isset( $settings['burger']['position'] ) ? $settings['burger']['position'] : 'left';
        $mobile_categories_menu = ($mobile_categories) ? $settings['burger']['menu_id'] : '';
    } else {
        return '';
    }
    echo '<div class="mobile-nav slide-from-' . esc_attr( $position ) . '">';
        if ( $search_form ) {
            woodmart_search_form( $search_args );
        }
        if( $mobile_categories ) {
            ?>
                <div class="mobile-nav-tabs">
                    <ul>
                        <li class="mobile-tab-title mobile-pages-title active" data-menu="pages"><span><?php esc_html_e('Menu', 'woodmart'); ?></span></li>
                        <li class="mobile-tab-title mobile-categories-title" data-menu="categories"><span><?php esc_html_e('Categories', 'woodmart'); ?></span></li>
                    </ul>
                </div>
            <?php
            echo '<div class="mobile-menu-tab mobile-categories-menu">';
            if( ! empty( $mobile_categories_menu ) ) {
                wp_nav_menu(
                    array(
                        'menu' => $mobile_categories_menu,
                        'menu_class' => 'site-mobile-menu',
                        'walker' => new WOODMART_Mega_Menu_Walker()
                    )
                );
            } else {
                ?>
                    <span class="create-nav-msg"><?php esc_html_e('Set your categories menu in Theme Settings -> Header -> Menu -> Mobile menu (categories)', 'woodmart'); ?></span>
                <?php
            }
            echo '</div>';
        }
        echo '<div class="mobile-menu-tab mobile-pages-menu active">';
        if( isset( $menu_locations['mobile-menu'] ) && $menu_locations['mobile-menu'] != 0 ) {
            $location = 'mobile-menu';
        }
        if( has_nav_menu( $location ) ) {
            wp_nav_menu(
                array(
                    'theme_location' => $location,
                    'menu_class' => 'site-mobile-menu',
                    'walker' => new WOODMART_Mega_Menu_Walker()
                )
            );
        } else {
            ?><span class="create-nav-msg">
                <?php 
                    printf( 
                        wp_kses( __('Create your first <a href="%s"><strong>navigation menu here</strong></a>', 'woodmart')
                            , array(
                                'a' => array(
                                    'href' => array()
                                )
                            )
                        )  
                    , $menu_link);
                ?>
                </span><?php
        }
        echo '</div>';
     ?>
    <?php if( is_active_sidebar( 'mobile-menu-widgets' ) ): ?>
        <?php woodmart_lazy_loading_deinit( true ); ?>
        <div class="widgetarea-mobile">
            <?php dynamic_sidebar( 'mobile-menu-widgets' ); ?> 
        </div>
        <?php woodmart_lazy_loading_init(); ?>
    <?php endif;
    echo '</div><!--END MOBILE-NAV-->';
}
add_action( 'wp_footer', 'woodmart_mobile_menu', 130 );