Site logo

Archived topic

HTML Order for Secdondary Navigation in Header

8 replies · Started by Stephane Bergeron on March 13, 2019

Viewing posts 1–9 of 9

Hi there,

I'm looking for whatever hooks I could use to move the Secondary Menu HTML in the header (Navigation Location: Float Right in customizer).

For now, it appears before the logo in the code and I'd want it after so it behaves better in responsive. Our Primary menu is displayed above header.

Thanks!

I found this :

add_action( 'generate_after_header_content', 'generate_add_navigation_float_right', 5 );

So I'm trying this:


add_action( 'after_setup_theme', 'zw3_move_secondary_nav' );
function zw3_move_secondary_nav() {
	remove_action( 'generate_after_header_content', 'generate_add_navigation_float_right', 5 );
	add_action( 'generate_after_header_content', 'generate_add_navigation_float_right', 11 );
}

But that is not working. The menu is not removed or added. So I would really appreciate some pointers here.

Thanks!

Hi there,

try this:

add_action( 'after_setup_theme','tu_move_secondary_nav' );
function tu_move_secondary_nav() {
	remove_action( 'generate_before_header_content', 'generate_add_secondary_navigation_float_right', 7 );
	add_action( 'generate_after_header_content', 'generate_add_secondary_navigation_float_right', 7 );
}

Worked great thank you!!!! :)

You're welcome :)

Are these documented anywhere?

Specific functions/hooks like this aren't documented anywhere, unfortunately. Honestly, I'm not super happy with the way the navigation is added to hooks currently - it makes them too difficult to move around (as you found out).

Unfortunately, we aren't able to improve it without breaking it for people who have moved them around. Hopefully I'm able to come up with something soon :)

I have confidence in you Tom! ;)

But I do get the importance of backwards compatibility.

I don't mind doing it with hooks (I'm used to that with Genesis) but documenting important ones like that would be good. There's a very useful "Code Snippets" section like that in the Genesis docs that document common hook based mods people often need to do. Something like that here would be great for things that cannot be done in the Customizer or in Elements.

In this case though, I think an additional option in the Customizer would make sense. I understand why in many cases it makes sense to have the floated right secondary menu above the logo. But not always.

Thanks again!

Really appreciate the feedback! I'll see what I can do :)

This archived topic is closed to new replies.