Site logo

Archived topic

I want to have a second menu on certain pages - what is the best way?

7 replies · Started by Brent Wilson on March 7, 2023

Viewing posts 1–8 of 8

On a site with a primary menu and a hero element, I would like to have a second menu located below the hero element on certain pages. What would be the best way to achieve this?

In addition, there will be second menus related to different groupings of pages - so that second menu on some pages would be "second menu 1," while on some other pages, that second menu would be "second menu 2," etc. Then some pages would have no second menu.

Hi Brent,

You can create a secondary navigation and set the navigation location to No navigation.

Then add this code to a hook element, choose the generate_after_header hook, set the priority to 15, and set the display rule per your needs, remember to tick theExecute PHP box.

<div class="second-nav">
	<?php 
	if ( function_exists( 'generate_secondary_navigation_position' ) ) {
		generate_secondary_navigation_position();
	}
	?>	
</div>

To have different menu items for the secondary navigation based on pages, you might need a plugin like this:https://wordpress.org/plugins/conditional-menus/

So if I have 3 different "secondary" navigation menus and want them to display on different pages or page categories, how would I distinguish between them when I set up the hooks?

how would I distinguish between them when I set up the hooks?

You don't specify it in the hook but in the plugin.

Add all menu items into the same menu, assign it to the secondary navigation, then use the plugin to control which menu items to show or not show.

Okay, I think I have the basics of this working using that plugin that you linked to. But how can I get the secondary nav "bar" to be full screen width instead of I think the 1200px content width? So this page to see what I am referring to: https://uniformministries.albertaadventist.ca/pathfinders/

Thanks! That worked!

No Problem, glad to help :)

This archived topic is closed to new replies.