Site logo

Archived topic

Secondary menu in the middle of header

3 replies · Started by Michael on June 30, 2021

Viewing posts 1–4 of 4

Hi

Am trying to implement and customise Algolia search (truly wonderful) and am getting somewhere with it. I mention this because I have set up a secondary menu which appears below the header with a search box. On the home page it looks fine, on the other pages where I have a custom element that increases the size of the header and displays featured image etc. The secondary menu appears inside of the header?

I'd love to have the secondary menu below the breadcrumb section ideally. Could this be done with another element and some kind of shortcode?

Hi there,

you can unhook the secondary navigation and rehook it eg. this snippet moves it to below the header element:

add_action( 'after_setup_theme','lh_move_secondary_navigation' );
function lh_move_secondary_navigation() {
    remove_action( 'generate_after_header', 'generate_add_secondary_navigation_after_header', 7 );
    add_action( 'generate_after_header', 'generate_add_secondary_navigation_after_header', 15 );
}

This line of the code is where it hooks back in:

add_action( 'generate_after_header', 'generate_add_secondary_navigation_after_header', 15 );

You can change generate_after_header to the same hook you have used for your Bredcrumb - as long as the Priority of 15 in this code is greater than the breadcrumbs priority ( which by default in a Hook element would be 10 ) then it will appear after it.

Hi David,

Perfect! Thank you ! It's support like this that keeps me with Generatepress (aside from great product). Just have to work out how to make sure the search headings separate into columns properly now and job done!

Thanks again...

Glad to be of help

This archived topic is closed to new replies.