I have a wordpress theme and in the header.php file it is displaying menus through this line :
wp_nav_menu( 'theme_location=menu_2&menu_id=nav&container=&fallback_cb=menu_2_default');
Now if I hover some menu item, it displays submenus items. I just want to change the layout of the submenu items section or div , but I can’t find any html of submenus. I need help in this
Submenu is appearing in the form of dropdown , I want to change this into a different style like this one :
The submenu markup is generated through the wp_nav_menu function. You will not find anywhere a “template” or “file” that allows you to modify the markup.
What is it that you want to change? If you can explain that, we may be able to provide alternate solutions for you.
Finally, if you really must change the markup that is generated, you can write a custom menu walker, but that requires some knowledge and skill with PHP.
You may be able to accomplish this with CSS.
wp_nav_menu
adds a lot of classes to each menu item, so you should be able to use relative positioning on the menu container. Then absolutely positionul.sub-menu
to the left and bottom of your menu container. If you make sure to usedisplay:none
on all sub-menus and thendisplay:block
with the current sub-menu, it theoretically should work without having to deal with an advanced Walker.