Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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:

http://yellowknife.se/artfex/

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

1 Answer 1

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

 
discard

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