Site logo

[Resolved] Move secondary navigation after custom header element

Home Forums Support [Resolved] Move secondary navigation after custom header element

Home Forums Support Move secondary navigation after custom header element

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #952812
    George

    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:

    View post on imgur.com

    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:

    https://imgur.com/7VLzxQb

    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.

    #952842
    David
    Staff
    Customer Support

    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:

    https://docs.generatepress.com/article/hooks-visual-guide/

    #952858
    George

    Amazing, David, thank you!

    #952860
    David
    Staff
    Customer Support

    You’re welcome

    #1279776
    Mark

    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.

    #1280363
    David
    Staff
    Customer Support

    Awesome – glad to hear that 🙂

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.