Menu item (dropdown-header type) don't work if depth = 0

Hello,

It’s supossed that if you put in a menú item, the attribute ‘dropdown-header with URL #’ the item is not clickable and it works only for naming a category. The problem is that it only works if depth is 1 (submenu).

I found in class-wp-bootstrap-navwalker.php that it puts if $depth === 1, so I tried removing that or modifying it to depth 0 but when I do it, all of the items that have a submenu, loose the submenu and caret.

`} elseif ( strcasecmp( $item->attr_title, 'dropdown-header' ) == 0 && <strong>1 === $depth</strong>) { $output .= $indent . '<li role="presentation" class="dropdown-header">' . esc_attr( $item->title );`

I want it to work in any level.

Thanks!

my url: www.santamariadelavictoria.es

Hi @gonzimalaga,

I hope you are well today and thank you for your question.

If you add menu item URL to # then it points to itself and clicking on it won’t make any effect.

Could you please tell me a bit more in detail what you are trying to achieve so that i can help you to achieve it?

Best Regards,
Movin

If you hover ‘HISTORIA’ and try to click ‘SANTUARIO’ you will see that you can’t click it. I want the same in ‘HISTORIA’ because, at the moment, you can click it (if you have scroll down a little it goes up when you click it).
Thanks!!

It seems this is happening because you have not added URL to the SANTUARIO menu item so please add it.

You can see it is working fine on your site for the menu item Cultos Anuales -> Novena because it has URL added.

I think you understand me the wrong way. :slight_smile:

You are saying that I need to change Santuario to be able to click it.

My willing are the inverse. I want Historia not being able to click (So I want Historia be like Santuario, not the other way as you suggested).

Thanks!

Hello there,

I hope you are doing well today.

You can use the following CSS code to have the pointer change it’s appearance by going to Appearance > Customize > Additional CSS and pasting it there.


/*Pointer change on menu hover*/
.navbar-default .navbar-nav > li {
    cursor: default;
}

Best Regards,
Support

Sorry but that doesn’t solve the problem… :S

Thanks anyway!

Hello there,

Please try removing the link from Historia and reload the page, if it still does not work please try this CSS code:


li#menu-item-166 {
    cursor: default;
}

Best Regards,
Support

Ok then you can use below custom CSS code to achieve this.

.navbar-default .navbar-nav > li > a[href="#"] {
    cursor: default !important;
}

Thanks Movin! Now it works fine!

:slight_smile:

You are most welcome here :slight_smile: