-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to align dropdown menu to left like Bootstrap's "dropdown-menu-right"? #382
Comments
navigation alignment happens in the UL element, where are your classes for that element? |
Yes, I know it is required to put the alignment class in the My expection is to get something like this:
But I'm geting it like this:
You may check my previous post to see the full output. Here I've just pointed the main elements. How can I achieve this from WP's menu editor? |
I just double checked your menu HTML, to clarify are you using Bootstrap 3? That looks like a Bootstrap 3 as bootstrap 4 containers are now div's with a list of the anchors. https://getbootstrap.com/docs/4.0/components/navs/#using-dropdowns The current walker is BS4, which may be why you're having a problem. There's a BSWalker v3 branch in the branch drop-down, see if that fixes your problem. |
@sptutusukanta My solution is by using Sass or CSS. On my case, I'm extending the class
|
I had the same problem. Would be awesome if there was a way to tell the navwalker, if a I tried @earvinpiamonte 's suggestion, but couldn't get it to work. I solved it by doing this (in my SASS/CSS):
|
I will be looking at enabling this with an easier method in the upcoming version of the walker (I hope to be working on it over the next 3 or 4 weeks). EDIT: For the moment one way to go about doing this would be to use the function filter_add_dropdown_side_right( $classes ) {
$classes[] = 'dropdown-menu-right';
}
add_filter( 'nav_menu_submenu_css_class', 'filter_add_dropdown_side_right' ); |
I needed to align the dropdown menu to the right, by default it is on the left.
As with bootstrap, we use
.dropdown-menu-right
class along with.dropdown-menu
to align dropdown menu.I tried to use it in menu class in admin panel, as expected it is populating in the parent
<li>
tag.Is there any other way to put this class from admin panel?
Here is the expected output as per Bootstrap's documentation:
Here is what I got add the class to menu from admin:
This is clear here, the class
.dropdown-menu-right
is placed to the parent<li>
tag, not with the<ul>
dropdown.The text was updated successfully, but these errors were encountered: