Personalized checkout and custom promotions with Shopify Scripts
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 %}
it works but it is duplicated and generates header and footer
HEEELP MEE PLEASE !! I AM NOOOB
Solved! Go to the solution
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!
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!
YYEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEES you helped me a lot!! hours trying and with your help it worked perfectly! I love you
Welcome! Would you mind hitting 'like' as well? Thanks!
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025