Site logo

Archived topic

dynamic header above menu

4 replies · Started by Michiel on May 31, 2018

Viewing posts 1–5 of 5

I want my primary navigation to appear underneath the dynamic header, both contained and the menu will not appear in a sidebar. Is there anyone who knows?

Hi Michael,

you can use this PHP snippet to move the navigation below the page header:

add_action( 'after_setup_theme','craig_move_navigation' );
function craig_move_navigation() {
    remove_action( 'generate_after_header', 'generate_add_navigation_after_header', 5 );
    add_action( 'generate_after_header', 'generate_add_navigation_after_header', 15 );
}

https://docs.generatepress.com/article/adding-php/

Then its a case of setting the page header and primary navigation to contained

Yes, it works! Thanks!

Glad i could help

1. generate_header would be better than after_setup_theme as it is recommended to hook as late as possible.

2. Nav bar can simply be hooked to generate_after_page_header at the default priority of 10 vs to generate_after_header at 15.

add_action( 'generate_header','craig_move_navigation' );
function craig_move_navigation() {
    remove_action( 'generate_after_header', 'generate_add_navigation_after_header', 5 );
    add_action( 'generate_after_page_header', 'generate_add_navigation_after_header' );
}
This archived topic is closed to new replies.