Hide Header and Footer Only on the Homepage

Solved

Hide Header and Footer Only on the Homepage

hatmakerr
Shopify Partner
5 0 1

I’m working on customizing my Shopify store and I’ve encountered an issue. I want the header and footer to be hidden only on the homepage, but visible on all other pages. I included a code snippet in the theme.liquid file that works to some extent, but not completely.

Here is the code I used:

{% if template.name != 'index' %}
  {% include 'header' %}
{% endif %}

{{ content_for_layout }}

{% if template.name != 'index' %}
  {% include 'footer' %}
{% endif %}

hatmakerr_0-1728250314911.png

it works but it is duplicated and generates header and footer

 

HEEELP MEE PLEASE !! I AM NOOOB 

Accepted Solution (1)

Made4uo-Ribe
Shopify Partner
10043 2388 3016

This is an accepted solution.

Hi @hatmakerr 

Check this one. 

From your Shopify admin dashboard, click on "Online Store" and then "Themes"

Find the theme that you want to edit and click on "Actions" and then "Edit code".

In the "theme. Liquid" file. Find the </body> tag and paste the code below before the tag. 

 

{% if template.name == 'index' %}
<style>
.header, .footer {
    display: none;
}
</style>
{% endif %}

 

And Save. 

 

 

Please don't forget to Like and Mark Solution to the post that helped you. Thanks!

If this fixed your issue, Likes and Accept as Solution are highly appreciated. Coffee tips fuel my dedication.
Get experienced Shopify developers at affordable rates—visit Made4Uo.com for a quick quote!
Need THEME UPDATES but have custom codes? No worries, for an affordable price.

View solution in original post

Replies 3 (3)

Made4uo-Ribe
Shopify Partner
10043 2388 3016

This is an accepted solution.

Hi @hatmakerr 

Check this one. 

From your Shopify admin dashboard, click on "Online Store" and then "Themes"

Find the theme that you want to edit and click on "Actions" and then "Edit code".

In the "theme. Liquid" file. Find the </body> tag and paste the code below before the tag. 

 

{% if template.name == 'index' %}
<style>
.header, .footer {
    display: none;
}
</style>
{% endif %}

 

And Save. 

 

 

Please don't forget to Like and Mark Solution to the post that helped you. Thanks!

If this fixed your issue, Likes and Accept as Solution are highly appreciated. Coffee tips fuel my dedication.
Get experienced Shopify developers at affordable rates—visit Made4Uo.com for a quick quote!
Need THEME UPDATES but have custom codes? No worries, for an affordable price.
hatmakerr
Shopify Partner
5 0 1

YYEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEES you helped me a lot!! hours trying and with your help it worked perfectly! I love you

Made4uo-Ribe
Shopify Partner
10043 2388 3016

Welcome! Would you mind hitting 'like' as well? Thanks!

If this fixed your issue, Likes and Accept as Solution are highly appreciated. Coffee tips fuel my dedication.
Get experienced Shopify developers at affordable rates—visit Made4Uo.com for a quick quote!
Need THEME UPDATES but have custom codes? No worries, for an affordable price.