Skip to content

Instantly share code, notes, and snippets.

@imuhammadshoaib
Last active March 1, 2023 07:14
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save imuhammadshoaib/19ec63889bcf0bd0ac038cf86e850a50 to your computer and use it in GitHub Desktop.
Save imuhammadshoaib/19ec63889bcf0bd0ac038cf86e850a50 to your computer and use it in GitHub Desktop.
Make parent link clickable in Bootstrap with Wordpress NavWalker
//FROM
$atts['href'] = '#';
$atts['data-toggle'] = 'dropdown';
$atts['aria-haspopup'] = 'true';
$atts['aria-expanded'] = 'false';
$atts['class'] = 'dropdown-toggle nav-link';
$atts['id'] = 'menu-item-dropdown-' . $item->ID;
//TO
$atts['href'] = ! empty( $item->url ) ? $item->url : '';
$atts['aria-haspopup'] = 'true';
$atts['aria-expanded'] = 'false';
$atts['class'] = 'dropdown-toggle nav-link';
$atts['id'] = 'menu-item-dropdown-' . $item->ID;
/*
*Add this CSS in your (style.css) file.
*/
.dropdown:hover>.dropdown-menu {
display: block;
}
@internick2017
Copy link

Thank still works

@asankasandz
Copy link

thanks that works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment