Site logo

Archived topic

How to stick my mobile secondary menu with primary navigation on mobile

1 reply · Started by Kristan on August 14, 2020

Viewing posts 1–2 of 2

Hi I'm looking for a solution on how to stick on scroll my secondary menu to the primary menu on mobile. I see that there are existing topics already regarding this but none of those codes worked for me. Thank you!

Hi there,

you can try moving the secondary nav inside the Primary Navigation like so:

1. Create a new Hook Element:
https://docs.generatepress.com/article/hooks-element-overview/
Give it a title eg. Nest Secondary Navigation inside Primary
Add this to the content text area:

<?php generate_secondary_navigation_position(); ?>

Select: inside_navigation Hook
Check Execute PHP
Set Display Rules tab Location: Entire Site.

2. Customizer > Layout > Secondary Navigation.
Set Container: Full Width, Inner Container: Contained, Alignment: Right, Location: No Navigation

It may require a little CSS to position and probably disable on mobile. Which i can assist with. But this way the two navs are both part of the sticky nav.

This archived topic is closed to new replies.