Conditional menus in wp header?
-
I’m hoping somebody can help sort this out, I’m a little perplexed at the moment with this. Basically, I’m trying to output the correct custom wp menu based on location using:
<?php echo do_shortcode( '[wpgc_is_state_code state_code="NJ"]' .wp_nav_menu( array('menu' => 'NJ' )). '[/wpgc_is_state_code]' ); ?> <?php echo do_shortcode( '[wpgc_is_state_code state_code="NY"]' .wp_nav_menu( array('menu' => 'NY' )). '[/wpgc_is_state_code]' ); ?> <?php echo do_shortcode( '[wpgc_is_state_code state_code="DC"]' .wp_nav_menu( array('menu' => 'DC' )). '[/wpgc_is_state_code]' ); ?>
The only problem with this is that it looks like the conditions are ignored as it just echos all three simultaneously.
**I originally tried using [wpgc_is_state_codes] but when I tried it on a page using the post editor, it ignored my state and went for the condition – Is that shortcode depreciated? (say no please)
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Conditional menus in wp header?’ is closed to new replies.