Jump to content

Adding categories to main navigation

Go to solution Solved by tuanphan,

Recommended Posts

I know I can just add links to the main navigation to go to categories but my issues is it won't show those pages as active because it considers them external links. There is a button in store settings> categories> that says "add to main navigation" (see attachment for reference screenshot) but it doesn't do anything/ doesn't work when clicked. 

Any insight would be much appreciated. 

Thank you!

Screenshot 2023-06-10 at 10.49.40 PM.png

Link to comment
  • Replies 10
  • Views 1.3k
  • Created
  • Last Reply

Top Posters In This Topic

  • 2 weeks later...
14 hours ago, mister_nar said:

Yes.

Try adding this code to Last Line in Code Injection > Footer

<script>
if (document.location.pathname.indexOf("/shop/manufacturing") == 0) {
    document.querySelector('body').classList.add('t-active')
}
 if (document.location.pathname.indexOf("/shop/supply") == 0) {
    document.querySelector('body').classList.add('t-active')
}
  </script>
<style>
  t.active header#header [href*="/shop/manufa"], t.active header#header [href*="/shop/supply"] {
    border-bottom: 1px solid;
}
</style>

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • Solution
On 6/26/2023 at 1:21 AM, mister_nar said:

hmmmm I've the code in there but it doesn't seem to be working. 

I miss a - symbol. Use this new code

<script>
if (document.location.pathname.indexOf("/shop/manufacturing") == 0) {
    document.querySelector('body').classList.add('t-active')
}
 if (document.location.pathname.indexOf("/shop/supply") == 0) {
    document.querySelector('body').classList.add('t-active')
}
  </script>
<style>
  body.t-active header#header [href*="/shop/manufa"], body.t-active header#header [href*="/shop/supply"] {
    border-bottom: 1px solid;
}
</style>

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • 4 weeks later...
On 7/23/2023 at 6:46 AM, TRBZINK said:

i am having the same problem, with categories not showing in the header, the solution above is not working? and i configured the code to use the /shop/abode like my site categories. https://conch-platinum-mf8h.squarespace.com/

 

What is access password?

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.