We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

How to hide header and footer for specific page templates?

Solved

How to hide header and footer for specific page templates?

kasm2013
Visitor
2 0 0

Hello,

 

I've created a page template named landing-page. When I put this code into my theme.liquid file it doesn't hide the header and footer for pages using that template. Can someone explain what is going on?

 

    {% if template.name == 'landing-page' %}
    <style>
.header-wrapper{
    display: none !important;
}

footer.footer{
    display: none !important;
}
</style>

      {% endif %}
Accepted Solution (1)

dlucasify
Shopify Partner
1 1 1

This is an accepted solution.

Your code isn’t working because template.name doesn’t exist in theme.liquid. Use template instead, like this:

{% if template == 'page.landing-page' %}
  <style>
    .header-wrapper {
      display: none !important;
    }
    footer.footer {
      display: none !important;
    }
  </style>
{% endif %}

Make sure your page is using the landing-page template correctly in the Shopify admin. Let me know if you want to fully remove it in the layout instead of just hiding it with CSS.

View solution in original post

Replies 5 (5)

dlucasify
Shopify Partner
1 1 1

This is an accepted solution.

Your code isn’t working because template.name doesn’t exist in theme.liquid. Use template instead, like this:

{% if template == 'page.landing-page' %}
  <style>
    .header-wrapper {
      display: none !important;
    }
    footer.footer {
      display: none !important;
    }
  </style>
{% endif %}

Make sure your page is using the landing-page template correctly in the Shopify admin. Let me know if you want to fully remove it in the layout instead of just hiding it with CSS.

kasm2013
Visitor
2 0 0

This did it! Thank you SO MUCH!

CodingFifty
Shopify Partner
1102 161 190

Hey! @kasm2013,

Go to your Shopify Admin Panel.

Navigate to Online Store → Themes.

Click on Edit Code (not Customize).

Open the theme.liquid file (found inside the Layout folder).

Scroll down and paste the code just before the </head> tag:

{% if page.handle == 'landing-page' %}
  <style>
    .header-wrapper {
      display: none !important;
    }

    footer.footer {
      display: none !important;
    }
  </style>
{% endif %}
Coding Fifty || Shopify Partner
For any custom section queries, please visit: Fiverr Profile
Found my response useful? Like it and mark as Accepted Solution!
For additional discussions, reach out via: Email ID: codingfifty@gmail.com

Dan-From-Ryviu
Shopify Partner
12073 2359 2539

Hi @kasm2013 

Could you share the link to your page? 

- Helpful? Like & Accept solution!
- Ryviu - Product Reviews & QA app: Collect customer reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image - Gain customers with photo gallery, video & shoppable image.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.

Vi-WizzCommerce
Shopify Partner
236 9 28

Hello @kasm2013 !

 

Sorry to hear you're dealing with this issue! 

 

You're close — but the problem is that theme.liquid can't reliably detect template.name for JSON-based templates (like page.landing-page.json), especially in Shopify's newer Online Store 2.0 themes (like Ride, Dawn, etc.).

 

Best Practice: Use template or request object in theme.liquid

Instead of template.name, use:

 

{% if template == 'page.landing-page' %}

 

OR (for older themes):

{% if request.page_type == 'page' and request.template == 'page.landing-page' %}

 

So update your snippet to:

{% if template == 'page.landing-page' %}
<style>
.header-wrapper {
display: none !important;
}
footer.footer {
display: none !important;
}
</style>
{% endif %}

 

Alternative (cleaner): Remove header/footer in template file

 

Instead of hiding with CSS, you can remove the includes from the template itself:

  1. Go to templates/page.landing-page.json

  2. Remove or comment out "header-group" and "footer-group" from the sections array:

{
"name": "Landing Page",
"sections": {
"main": {
"type": "main-page",
"settings": {}
}
// Do NOT include "header-group" or "footer-group"
},
"order": [
"main"
]
}

This will render a completely headerless + footerless layout, without needing CSS hacks.

 

 

Debug Tip

You can temporarily print this in your theme.liquid to see what template Shopify thinks it’s using:

 

{{ template }}
<!-- OR -->
{{ request }}

 

If this reply was useful to you, we would really appreciate it if you gave us a LIKE and mark the issue as SOLVED!

 

 

Check here Wizzcommerce Apps to optimize your store: Snap Presale & Backorder | SnapNoti FOMO Visitor Counter | SnapBundle Volume Discounts | Wizz Flash Sale & Price Edit | BOGO+ | Buy X Get Y Free Gift | Snap Cart Drawer & Cart Upsell
Find more support, feel free to contact: support@wizzcommerce.io