Support » Plugin: WP Geocode Filter » 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)

    http://wordpress.org/plugins/wpgeocode/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Kyle

    (@kyleheldskybounddesignscom)

    Ditto.

    Plugin Author mikelynn

    (@mikelynn)

    This approach absolutely works in the latest version of wpgeocode. I am leveraging the following code in the header at http://www.wpgeocode.com

    <center>Proudly developed in Philadelphia for users in <?php echo do_shortcode(‘[wpgc_city]’); echo ‘, ‘ . do_shortcode(‘[wpgc_state_code]’) .’ ‘. do_shortcode(‘[wpgc_country_code]’);?></center>

    Not sure about the navmenu – but do_shortcode definitely works in themes.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Conditional menus in wp header?’ is closed to new replies.