QUESTION: How to modify theme code to add additional sections

Solved

QUESTION: How to modify theme code to add additional sections

draxx-life24
Tourist
6 0 1

Greetings, 

MAIN QUESTION: 

  • How do I modify my theme code in order to allow sections in different parts of my theme.
  • Could someone also explain what part of the code controls which sections can or can not be selected in a given part of the theme layout?

DETAILS:

  • I want to add a "highlight banner" section to my header but I do not have the option to add this section to my header. 
  • I'm comfortable moving around the code but I'm still learning how the different shopify files relate to each other.
  • My core theme is "Empire by Pixel Union"

SCREEENSHOTS:

Any thoughts would be helpful.

Accepted Solution (1)

Muhammad_Ali_S
Shopify Partner
669 122 185

This is an accepted solution.

Hi @draxx-life24 

Go to Edit code > sections/dynamic-highlights-banner.liquid and remove the below mentioned code.

,
  "disabled_on": {
    "groups": ["*"]
  }


1910f8a9-2929-44ef-b7c2-5906f3b3f6b8.png

Ali Shahzad | Designer | Developer
- Was my reply helpful? Click Like and Accepted Solution to let me know!
- Feel Free to Contact | Whatsapp +92 3486775142

View solution in original post

Replies 7 (7)

PaulMartin
Shopify Partner
457 52 106

Hey Draxx

To answer your main questions,

- First, you'll be creating your section, right? After creating your section, in order to add it into a part of your theme, you either need to add it via code via the templates of choice or via the theme editor. If you prefer adding the section via the theme editor, you'll need to modify your section's schema code to include "presets" attribute. Section schema (shopify.dev) - Presets. You don't necessarily allow parts of the theme to include a section, you allow that section to be part of a theme, if that makes sense. The next answer should shed light on what I meant.

- The part of code that controls which sections can or cannot be selected in a given part of the theme layout is the section schema, specifically the "enabled_on" or "disabled_on" part of section schema. Section schema (shopify.dev) - enabled_on

For adding a new section to your header, you'll want to read more about header groups or section groups in general. Section groups (shopify.dev)

Hope this helps! If you have any questions, feel free to let me know.

Contact here for WhatsApp | Email
$20 start rate for theme fix & customization
Don't forget to like and mark as solution
draxx-life24
Tourist
6 0 1

Hey Paul we meet again. 

Thanks for this information. I will look into this now.

To your question... My plan was to take the pre-created "Highlight Banner" and make a duplicate with my custom changes.

PaulMartin
Shopify Partner
457 52 106

Hello! I knew that name was familiar hahaha.

Ah okay! Well, Muhammad was able to answer it, so I guess that's that. Thank you, Muhammad!

I thought you needed the docs and weren't able to locate them. That should help you in the future whenever you'll need it.

Contact here for WhatsApp | Email
$20 start rate for theme fix & customization
Don't forget to like and mark as solution

Muhammad_Ali_S
Shopify Partner
669 122 185

This is an accepted solution.

Hi @draxx-life24 

Go to Edit code > sections/dynamic-highlights-banner.liquid and remove the below mentioned code.

,
  "disabled_on": {
    "groups": ["*"]
  }


1910f8a9-2929-44ef-b7c2-5906f3b3f6b8.png

Ali Shahzad | Designer | Developer
- Was my reply helpful? Click Like and Accepted Solution to let me know!
- Feel Free to Contact | Whatsapp +92 3486775142
draxx-life24
Tourist
6 0 1

Hey Muhammad, 

Thanks so much for chiming in. I will try this now.

draxx-life24
Tourist
6 0 1

Marking Muhammad's response as a solution since it directly answers my question. 

For anyone who finds this thread also view Paul Martins above response since it provides more commentary and links to docs.

Muhammad_Ali_S
Shopify Partner
669 122 185

@draxx-life24 
You're welcome.

Ali Shahzad | Designer | Developer
- Was my reply helpful? Click Like and Accepted Solution to let me know!
- Feel Free to Contact | Whatsapp +92 3486775142