Archived topic
How can I use Navigation as Header EXCEPT on the home page?
23 replies · Started by Salim on September 25, 2021
Hi there,
I'm currently having an issue that I believe stems from using the navigation as a header.
I'm unable to disable the header in any element unless I untick "use navigation as header" in the customisation settings.
Is there a way to have navigation be the header except on the front page? I'm looking to implement an animated logo on the front page only, and none of the CSS I've searched for in your forums work, unless I disable it as a header.
Having navigation as a header is super useful and helped me achieve the design I wanted on mobile and it looks great across the site.
I'm wondering if there's a CSS snippet or something I could use here.
Much appreciated
Hi there,
Enable the Navigation as Header in the Customizer, and the you can use this PHP Snippet to disable it on the front page.
add_filter( 'option_generate_menu_plus_settings', function( $settings ) {
if ( is_front_page() ) {
$settings['navigation_as_header'] = 'false';
}
return $settings;
} );
Thanks for your response!
I've added the snippet and also tried adding to the theme files, but unfortunately, it isn't working. Any ideas?
Where did you add the code exactly ? And are you using a Child Theme ?
I tried adding it to the code snippets plugin and also the theme itself. Neither worked. Not using a child theme (I know it's risky but I only need one or two lines added).
Hmmm... lets try the reverse logic. Disable the Navigation as Header option in the Customizer then try this PHP Snippet:
add_filter( 'option_generate_menu_plus_settings', function( $settings ) {
if ( !is_front_page() ) {
$settings['navigation_as_header'] = 'true';
}
return $settings;
} );
Hmm, still not working. Any further ideas?
So I have mobile menu enabled always, I got a CSS snippet through another support request and by searching through the forums. Would that affect things?
Can you share a link to the site ?
Added to the private notes section.
Do you have the Navigation as Header still enabled in the Customizer ? If so can you disable it.
Disabled now.
What other changes did you make ? Is the code i provided still active ?
As i on the front page i see neither the Site Header or the Navigation as Header.
I've been trying a ton of different things for hours now. I think I'll try a new strategy. I've removed navigation as a header, which wouldn't respond to your code. Is it possible to have the logo and site title hidden on the front page only?
Still though, when I disable the header, the primary navigation is taken out with it. And I just can't figure out why.
Ok so I was able to add primary navigation ABOVE the header, but now it won't sit on the right side. How can I achieve that? It's a bit of a hack but it's almost what I want if I can get the menu to float to the right above the header.
Also... I need to remove the site logo from the mobile menu on the front page only. Is that also possible? On another forum request I opened I was told this could be achieved through having the header be the navigation... Which caused the issues we're discussing now