- This topic has 8 replies, 3 voices, and was last updated 5 years, 1 month ago by Tom.
-
AuthorPosts
-
March 13, 2019 at 10:25 am #837991Stephane Bergeron
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!
March 13, 2019 at 12:06 pm #838077Stephane BergeronI 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!
March 13, 2019 at 1:41 pm #838145DavidStaffCustomer SupportHi 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 ); }
March 13, 2019 at 1:58 pm #838164Stephane BergeronWorked great thank you!!!! π
March 13, 2019 at 1:59 pm #838165DavidStaffCustomer SupportYou’re welcome π
March 13, 2019 at 2:00 pm #838166Stephane BergeronAre these documented anywhere?
March 13, 2019 at 5:07 pm #838251TomLead DeveloperLead DeveloperSpecific 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 π
March 13, 2019 at 6:38 pm #838299Stephane BergeronI 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!
March 14, 2019 at 8:32 am #838935TomLead DeveloperLead DeveloperReally appreciate the feedback! I’ll see what I can do π
-
AuthorPosts
- You must be logged in to reply to this topic.