jcadima
5/5/2017 - 9:19 PM

Make Parent Link Clickable

Make Parent Link Clickable


<?php 

/vendor/oxygenna/oxygenna-mega-menu/walkers/FrontendBootstrapMegaMenuWalker.php

// If item has_children add atts to a.
if ($args->has_children && $depth === 0) {
    if (oxy_get_option('hover_menu') === 'on' && !$oxy_is_iphone && !$oxy_is_android && !$oxy_is_ipad) {
        if ($item->object == 'oxy_mega_menu') {
            $oxy_mega_url = get_post_meta($item->ID, 'oxy_mega_url', true);
            // $atts['href'] = empty($oxy_mega_url) ? '#' : $oxy_mega_url;
            //$atts['href'] = empty($oxy_mega_url) ? $oxy_mega_url  : '' ;
            $atts['href']           = ( $item->url );
            $atts['data-toggle']    = 'dropdown';
            $atts['class']          = 'dropdown-toggle disabled';
            $atts['aria-haspopup']  = 'true';                        
        } else {
            $atts['href'] = ! empty($item->url) ? $item->url : '';
        }
    }
    else {
        // if we have a mobile with a mega menu hold the link as data attribute
        if ($oxy_is_iphone || $oxy_is_android ||$oxy_is_ipad) {
            if ($item->object == 'oxy_mega_menu') {
                $oxy_mega_url = get_post_meta($item->ID, 'oxy_mega_url', true);
                $atts['data-link'] = empty($oxy_mega_url) ? '#' : $oxy_mega_url;
               
            } else {
                $atts['data-link'] = ! empty($item->url) ? $item->url : '';
            }
        }
        $atts['href']           = ( $item->url );
       //  $atts['href']           = '#';  // COMMENT ONLY THIS LINE
        $atts['data-toggle']    = 'dropdown';
    }
    $atts['class']          = 'dropdown-toggle';
} else {
    $atts['href'] = ! empty($item->url) ? $item->url : '';
}




================== THIS SHOULD BE ENOUGH ===========================
// comment line 166 ONLY  
// If item has_children add atts to a.
if ($args->has_children && $depth === 0) {
    if (oxy_get_option('hover_menu') === 'on' && !$oxy_is_iphone && !$oxy_is_android && !$oxy_is_ipad) {
        if ($item->object == 'oxy_mega_menu') {
            $oxy_mega_url = get_post_meta($item->ID, 'oxy_mega_url', true);
            $atts['href'] = empty($oxy_mega_url) ? '#' : $oxy_mega_url;
        } else {
            $atts['href'] = ! empty($item->url) ? $item->url : '';
        }
    }
    else {
        // if we have a mobile with a mega menu hold the link as data attribute
        if ($oxy_is_iphone || $oxy_is_android ||$oxy_is_ipad) {
            if ($item->object == 'oxy_mega_menu') {
                $oxy_mega_url = get_post_meta($item->ID, 'oxy_mega_url', true);
                $atts['data-link'] = empty($oxy_mega_url) ? '#' : $oxy_mega_url;
            } else {
                $atts['data-link'] = ! empty($item->url) ? $item->url : '';
            }
        }
        // $atts['href']           = '#';
        $atts['data-toggle']    = 'dropdown';
    }
    $atts['class']          = 'dropdown-toggle';
}