How Do I Show Different Menus On Different Pages?
Turn on the Shortcode
In order to show different menu’s on different pages you will need to make sure you have enabled the
Use Shortcode? option from inside the Responsive Menu admin, shown in the screenshot below:
Once this has been setup, you can then use any type of logic you wish to determine which menu is shown and under what conditions. The below examples show you can use an if or case statement in PHP to filter by page template or page ID, however you can use whatever functionality you wish in its place.
These can easily be added to your
footer.php file just after or just before the opening/closing body tags.
Using an if statement based on page template
<?php if(get_page_template() == ‘full-page.php’) echo do_shortcode(‘[responsive_menu menu_to_use=”full-page-menu”]’); else echo do_shortcode(‘[responsive_menu]’); ?>
Using a switch statement based on page ID
<?php switch(get_the_ID()) : case 45 : $rm = ‘first-menu’; break; case 52 : $rm = ‘second-menu’; break; case 75 : $rm = ‘third-menu’; break; default : $rm = ”; endswitch; echo do_shortcode(‘[responsive_menu menu_to_use=”‘ . $rm . ‘”]’); ?>
On this page you will find valid values for the shortcode option above and more example uses including menus for different languages and logged in users.