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

Im kinda a noob but have made some homepages for fun but got this new one that im making for a friend that´s stopped my dead in my tracks:


The popup (ugly as hell and will be changed into images) gives the visitor the option of three different types of products to view. I need help with how to make a custom menu load when each of these three categories are clicked. I´ve googled but didnt get to far, to little codeexperience keeps me from getting it.

Anyone got any thoughts?

Thanks! Dave Sweden

share|improve this question

Once the category is selected it would be pretty easy with the help of wp_nav_menu to check what category is currently selected using is_category and then load the menu you need. This would be defined in your page template or header (depending on where your menu is loaded)

if (is_category('category 1')) { 
    wp_nav_menu( array('menu' => 'category1-nav') );
} else if (is_category('category 2')) { 
    wp_nav_menu( array('menu' => 'category2-nav') );
} else if (is_category('category 3')) { 
    wp_nav_menu( array('menu' => 'category3-nav') );

You will need to define the different menu's in your functions.php like this :

register_nav_menus( array(
'category1-nav' => 'Category 1 Navigation', 
'category2-nav' => 'Category 2 Navigation',
'category1-nav' => 'Category 1 Navigation'
) );

Once you've defined the menu's you can set them up under Appearance > Menu's in the admin area.

share|improve this answer
This might need refinement to work in your setup, I haven't tested this, but should work. – Digitalchild Mar 3 '11 at 9:47
Ah what an great answer! Thanks brother! Im gonna check it out now and try to learn what to look for and then make the changes you wrote. Thanks again! – user3667 Mar 10 '11 at 7:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.