Archived topic
Move secondary navigation after custom header element
5 replies · Started by George on July 9, 2019
I was wondering if there was an action to add a hook just after a custom header element. I have used the code in the post here:
https://generatepress.com/forums/topic/move-secondary-nav/
It's not exactly what I am after. On the default header with an image, you can set the secondary menu to be rendered after the header, like so:
With the above hook, the menu gets rendered before the content and as such, it's part of the content wrapper meaning it doesn't go full width and I need to adjust margins and paddings per page:
What I would like to do is to insert the secondary manu just after the custom element header's content and keep it full screen.
Hi there,
you can use the after_header hook with a higher priority to push it below the header element.
The Dispatch Site in the library uses the following method - which will also work with a full width site:
New hook: after_header
Content: <?php generate_secondary_navigation_position(); ?>
Priority: 15
Execute PHP
Then in customizer set the secondary nav location to No Navigation.
Alternative hook is the inside_container - you can see the 'uncontained' hooks here:
Amazing, David, thank you!
You're welcome
Thanks! Worked for me too. I didn't get it to work at first, but then realized I needed to set the display rules for the hook, as well. In my case I did it for the entire site.
Awesome - glad to hear that :)