Take the 2-minute tour ×

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 :


share|improve this question

closed as off-topic by Chip Bennett, Johannes Pille, toscho Aug 7 '13 at 16:50



Dropdown - as in when you hover over the menu item, the sub-menu appears? –  cale_b Aug 7 '13 at 14:32
Yes , I want to change this into the menu in the above link –  Hammad Shahid Aug 7 '13 at 14:35
As-written, this question is out of scope for WPSE, as it is purely a CSS question. The wp_nav_menu() provides menu/sub-menu HTML markup output. That markup just needs to be styled to your needs. –  Chip Bennett Aug 7 '13 at 15:56
Hammad, in the link you gave there are no sub menus. Each top level link goes to a new sub domain. Each sub domain has two menus. One for the top level menus and another specific to that sub domain. –  Charles Clarkson Aug 8 '13 at 17:19
add comment

2 Answers

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.

share|improve this answer
Submenu is appearing in the form of dropdown , I want to change this into a different style like this one : opinion.inquirer.net –  Hammad Shahid Aug 7 '13 at 14:27
@HammadShahid Can you point us at a URL to look at for the current menu? –  cale_b Aug 7 '13 at 14:32
Yes , top menu on the inquirer page. and for the current menu theme-dutch.com/how-to-set-up-a-submenu-in-wordpress Please notice the top (main) menus of both websites –  Hammad Shahid Aug 7 '13 at 14:33
add comment

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 position ul.sub-menu to the left and bottom of your menu container. If you make sure to use display:none on all sub-menus and then display:block with the current sub-menu, it theoretically should work without having to deal with an advanced Walker.

share|improve this answer
add comment
