WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions should be specific to WordPress within defined scope (merely happening in its context, such as generic PHP/JS/HTML/CSS, is insufficient). Might be better asked at Stack Overflow or other appropriate site of Stack Exchange network." – Chip Bennett, Johannes Pille, toscho
If this question can be reworded to fit the rules in the help center, please edit the question.

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

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

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.