Support » Plugins and Hacks » Hacks » Change menu based on passed parameters

  • vahost

    (@vahost)


    I need to be able to use a different menu depending on what parameter is being passed in the page’s URL.

    For instance, assume the URL: http://www.mydomain.tld/my-page?m=3

    In this case, the parameter m=3 indicates that I want the page to use menu #3.

    Are there any plugins that can help with this?

    Is there a way to shortcode menus so that I can call them programmatically in a simple php script?

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

    (@vahost)

    Can anyone help me with this?

    Moderator bcworkz

    (@bcworkz)

    I don’t know if there’s a plugin or not, and shortcodes would be over complicating things since the distinguishing information is in the URL parameter. Assuming the different menus have been registered and defined, you just need to do something on your page template like this:
    <?php wp_nav_menu( array( 'menu' => $_GET['m'] ) ); ?>

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change menu based on passed parameters’ is closed to new replies.