How to hide Main Nav menu on just ONE of my collections? Minimal Theme.

Solved
Highlighted
Tourist
3 0 1

Hi! I am using the Minimal theme. I'm trying to figure out how to hide the main nav menu from the header, for JUST ONE of my collection pages. I'd like the rest of my collections to show that nav menu.

I am NOT referring to the "breadcrumbs" but to the actual main nav in the header.

I'm feeling stuck... I have tried creating an alternate theme.liquid file and hiding the main nav, but I can't figure out how to apply that theme.liquid file to this collection. I have also created an alternate collection.liquid file, and I figured out how to select that file from the collection page, but I don't think that file contains any reference to the main nav, because that's in the theme.liquid file. 

I'm SURE there must be a way to do this, but I really don't know anything about CSS and code, so ... hoping someone else knows how? Thanks in advance!! :)
Eliza

0 Likes
Shopify Expert
115 21 42

Edit your layout/theme.liquid file. Right above the line that has

 

</head>

Add in

 

{% if collection.handle == 'COLLECTION_HANDLE' %}
<style>
nav {display: none;}
</style>
{% endif %}

Replace COLLECTION_HANDLE with the collection handle from the collection you want to hide the menu on. So as an example, on this page https://minimal-vintage.myshopify.com/collections/prints the collection handle is 'prints'

2 Likes
Highlighted
Tourist
3 0 1

Thank you so much for your advice! Unfortunately, this isn't doing it for me. Any suggestions for how to make this work? 
Here's the page that I'm trying to apply it to:

https://www.morrisessex.com/collections/wholesale-line-sheet

Thank you!!
Eliza

0 Likes
Highlighted
Shopify Expert
115 21 42

This is an accepted solution.

Looks like the code on your theme is a little different than the current version of minimal in Shopify's theme store.

 

Here's the code you can use: 

 

{% if collection.handle == 'wholesale-line-sheet' %}
<style>
.site-nav {display: none;}
</style>
{% endif %}
4 Likes
Highlighted
Tourist
3 0 1

AHHHHHH YES!!! Thank you so much, I REALLY appreciate your help, it worked! This is amazing! I've wasted a lot of time trying to figure this out myself, haha! Thank you so much for helping me figure it out at last! :D

-Eliza

1 Like
Highlighted
Shopify Expert
115 21 42

No problem! Glad I could help.

 

Also if you want to hide the button on mobile view too, use this code:

 

{% if collection.handle == 'wholesale-line-sheet' %}
<style>
.site-nav, .mobile-nav-trigger {display: none;}
</style>
{% endif %}
1 Like
Highlighted

you can also use that liquid 'if' statement but to wrap the entire menu so it doesn't even render on the source code, which speeds up page load for that page.  

{% if collection.handle == 'wholesale-line-sheet' %}
... HTML code of menu ... (maybe it's a simple 'include'?)
{% endif %}

 

1 Like
Highlighted
New Member
1 0 0

Hello,

 

I am trying to hide the PARTNERS section on my main menu.

 

https://americanheroescoffee.com/

 

Does anyone know how to hide it without deleting it - I'd like to still be able to give out the URL for the partner pages underneath but I do not want them to show on my website - only if they have the link.

 

Thank you!

0 Likes
Highlighted

You can just remove the item "Press" from the navigation menu. That way the page (and link) isn't deleted, it just doesn't show up on the menu itself.

0 Likes
Highlighted
New Member
2 0 0

Hi Eric_K_

I'm trying to accomplish the same thing. I want to hide a specific navigation collection menu from my header while I import products to it from Oberlo until a certain date. I tried your steps and I wasn't able to hide the specific collection from the header. I have the Minimal theme. I'm not able to import products from Oberlo, because I have to have a collection available on the navigation menu to import it to.

I deleted the collection from the navigation menu and made it unavailable on my store, because I don't want my customers to interact with it until next month. The url would be:

https://poshcarbon.com/collections/christmas-in-july

 

Thank you

Aisha

0 Likes