(HELP!!!) How to make my two different headers show on different pages

premisesdist
Visitor
2 0 0

I have a differently designed index page, in which my header is different to the one i want for my product pages ect. i have been working on this for a very long time. I have duplicated my header.liquid file and made a header2.liquid file, in which i want to show on every page but my index page. The problem i have is, I cannot seem to find a way to show the different headers on different pages. I reference 'header' in a {% if template.name == 'index'%} {% sections 'header'%} code (screenshot attached), but it does not show the contents of the 'header.liquid' file, although, it shows it when i use 'header-group' instead of it. This is a problem, as when i use 'header2', it does not show the header2.liquid file, which i need to have. Anyone have a fix for this, or a different word i can use in the {% sections 'header'%} part? THANKYOU!

premisesdist_1-1709555495359.png

 

 

Replies 3 (3)

webwondersco
Shopify Partner
1045 158 156

@premisesdist Hope you are doing well.

 

Could you please share your store URL? if it is password protected please share the password as well.

 

Web Wonders | Shopify Partner | Connect here!
- Question answered? Mark as Accepted Solution, reply helpful? Click Like
- Hire me, if you want to design, re-design, develop a store, or make changes to the pre-built store.
a small Coffee Tip would be greatly appreciated. 🙂
premisesdist
Visitor
2 0 0

www.premisesdist.com

only the front page is up right now as the others dont work.

Vinsinfo
Shopify Partner
181 61 55

@premisesdist 

Please follow the below steps to make two different headers show on different pages and let me know whether it is helpful for you.
 
1. From admin, go to "Online Store" -> "Themes".
2. Click action button from the current theme and select "Edit code".
3. Locate the theme.liquid and the Replace your code with below one like in the attached screenshot.

 

{% if template.name == 'index' %}
    {% section 'header' %}
{% else %}
    {% section 'header2' %}
{% endif %}

priyavinsinfo_0-1709799372170.png

 

4. Save the changes and check frontend for two different headers on different pages.
 
Please provide your support by click "Like" and "Accepted" if our solution works for you. Thanks for your support.