Wordpress Menu dropdown parent item clickable just after opening dropdown

Viewed 16

I am currently developing a website and I need to make my dropdown menu parent item clickable. I have modified the wp-bootstrap-navwalker.php file to :

        // If item has_children add atts to a.
if ( $args->has_children && $depth === 0 ) {
   $atts['href'] = ! empty( $item->url ) ? $item->url : '';
   //$atts['data-toggle']   = 'dropdown';
   $atts['class']           = 'dropdown-toggle';
} else {
   $atts['href'] = ! empty( $item->url ) ? $item->url : '';
}

Code which adds indeed a link to my parent item, but that is only happening after I open the dropdown - So if I want tot open the link to the whole category(Parent Item) i have to click twice, once for opening dropdown and the second time for actually going to the link.

I think it may be a theme problem that is having some loading order code but I do not actually know where, the theme I am using is Uncode. After using that code, on Inspect element i do not see the data-toggle information, so it worked, but not quite.

0 Answers
Related