Archived topic
How to create new navigation location and display using elements?
3 replies · Started by William on June 4, 2019
I need to create a navigation that will reside on only a handful of pages. I would like the client to be able to mange this via menus, and I'll include it via elements & display rules.
Leveraging the existing Secondary Menu might work; but how would I stop displaying that globally, and instead include it via elements & display rules?
Ideally I would be able to create a new menu and then include it via elements & display rules - maybe using a shortcode? I say this because the client *may* want more than one new navigation, specific to certain content areas.
Many thanks, Will
Hi there,
you can hook the secondary navigation using a Hook Element with this code:
<div class="second-nav grid-container">
<?php generate_secondary_navigation_position(); ?>
</div>
Select the Hook where you want to place it.
Check the Execute PHP checkbox.
And set your display rules.
In the Customizer > Layout > Secondary Naviagation set the Location to No Navigation.
To create different navigation instances will be difficult and require custom development. Instead i would suggest a plugin like:
https://en-gb.wordpress.org/plugins/if-menu/
or
That works perfectly for this purpose, thank you very much!!!
In the future, if we could create new menu locations easily that would help.
Best regards, Will
You're welcome