<?php
$p_menu = solarva()->get_page_opt('p_menu');

$main_menu = !empty($p_menu) ? $p_menu : $settings['menu'];
$menu_item_icon = !empty($settings['pxl_icon']['value']) ? $settings['pxl_icon']['value'] : '';


$main_menu_classes = $settings['menu_hover'];
$sub_menu_classes = $settings['sub_show_effect'];
$classes = $main_menu_classes.' '.$sub_menu_classes.' '.$settings['menu_mega_type'].' '.$settings['pxl_animate']; ?> 

<?php if(!empty($main_menu)) : ?>
    <div class="pxl-nav-menu pxl-nav-menu1 <?php echo esc_attr($classes); ?>" data-wow-delay="<?php echo esc_attr($settings['pxl_animate_delay'].'ms'); ?>">
        <?php wp_nav_menu(array(
            'theme_location' => 'primary',
            'menu_class' => 'pxl-menu-primary ',
            'walker'     => class_exists( 'PXL_Mega_Menu_Walker' ) ? new PXL_Mega_Menu_Walker : '',
            'link_before'     => '<span class="pxl-menu-item-text">',
            'link_after'      => '<span class="pxl-item-menu-icon pxl-hide '.$menu_item_icon.'"></span></span>',
            'menu'        => wp_get_nav_menu_object($settings['menu']))
        ); ?>
    </div>
<?php elseif( has_nav_menu( 'primary' ) ) : ?>
    <div class="pxl-nav-menu pxl-nav-menu1 <?php echo esc_attr($classes); ?>">
        <?php $attr_menu = array(
            'theme_location' => 'primary',
            'menu_class' => 'pxl-menu-primary ',
            'link_before'     => '<span class="pxl-menu-item-text">',
            'link_after'      => '</span><span class="pxl-item-menu-icon pxl-hide '.$menu_item_icon.'"></span></span>',
            'walker'         => class_exists( 'PXL_Mega_Menu_Walker' ) ? new PXL_Mega_Menu_Walker : '',
        );
        wp_nav_menu( $attr_menu ); ?>
    </div>
<?php endif; ?>
