php - If category/page in wp_nav_menu exist -


i need

i have 3 custom menu(wp_nav_menu) customize via admin menu section.

<!-- first menu ->     <?php companymenu(); ?> <!-- second menu ->     <?php servicesmenu(); ?> <!-- third menu ->     <?php partnersmenu(); ?> 

i want show 1 nav menu opened post/page/category belongs

for example: when i'm on home page click "contacts" in menu redirects me "contacts" page , because page defined (with other menu links) in companymenu() wp_nav_menu function shows

it depend on how many pages need check against solution viable- fewer pages better.

you wrap menu code in if statements , use is_page wordpress function check if on page. see link below more information.

http://codex.wordpress.org/function_reference/is_page

code example

if(is_page( 'contact' )){ servicesmenu(); } 

as general rule wordpress codex has great wealth of knowledge found helpful when starting wordpress development


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -