- This topic has 7 replies, 2 voices, and was last updated 3 years, 1 month ago by
Ying.
-
AuthorPosts
-
March 7, 2023 at 1:07 pm #2559325
Brent Wilson
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.
March 7, 2023 at 2:34 pm #2559377Ying
StaffCustomer SupportHi 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_headerhook, set the priority to15, and set the display rule per your needs, remember to tick theExecute PHPbox.<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/
March 7, 2023 at 2:39 pm #2559379Brent Wilson
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?
March 7, 2023 at 2:57 pm #2559399Ying
StaffCustomer Supporthow 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.
March 7, 2023 at 3:34 pm #2559415Brent Wilson
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/
March 7, 2023 at 3:54 pm #2559424Ying
StaffCustomer SupportI’ve removed the
grid-containerclass from the code, try this one instead:
https://generatepress.com/forums/topic/i-want-to-have-a-second-menu-on-certain-pages-what-is-the-best-way/#post-2559377March 7, 2023 at 4:11 pm #2559428Brent Wilson
Thanks! That worked!
March 7, 2023 at 4:31 pm #2559437Ying
StaffCustomer SupportNo Problem, glad to help 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.