Remove header/footer from specific template 2.0

Hi,

I’m trying to create a marketing landing page that has no header, footer, or announcement bar. I’ve tried a myriad of suggestions from youtube, other community discussions, and Google search. Nothing works.

What I want to do is have a separate ‘template’ called landing-page, that I can select to create new pages whenever we’re running a marketing campaign. I don’t want any other links on that page.

I’ve tried setting up a template in theme code edit called landing-page, but it has included code from another template, which I don’t want, and can’t seem to remove. I have tried making changes in theme.liquid (to header and footer ), but that was from a video using 1.0 and I have 2.0, so that didn’t work.

Can anyone offer advice on what I can try next?

Cheers,

Hi @WildLilli

Could you share your page URL so I can give you the solution?

Thank you for a fast reply.

Let’s start with point one - creating a new template. I presume you mean in
themes/code edit / add a new template? If so, when I click on ‘add a new
template’ there is not a ‘default’ option. The options are to select:
product, index, pages gift_card etc. Previously, I had selected ‘page’. Am
I in the wrong place?
(My theme is Studio 11.0.0)

Thanks @Dan-From-Ryviu for replying.

I don’t have a URL yet because I don’t have a template set-up. I need the template so I can create as many marketing campaign pages as I want in the future. Cheers,

Hi @WildLilli

So you can try to add this code before tag of your theme.liquid file after creating “landing-page” template

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

{% endif %}

Hi @Dan-From-Ryviu

I added the Landing-page template as I had previously. Then went to theme.liquid and added your code. See image. It seems to be in the right place but it hasn’t removed the header/footer - https://wildlilli.com/pages/landing

Please try to use this code instead of

{% if template == 'landing' %}

{% endif %}

Have added code. Doesn’t seem to work. Everything I have set up says landing-page. The code should be the template name shouldn’t it?

landing-page-1.png

I went back, changed the code to landing-page and tested another page using the landing-page template and it hasn’t worked https://wildlilli.com/pages/printable-art-revolution-1 I’m sure there is a simple reason, I just can’t see it.

This code will solve the issue

{% if page.handle == 'landing' %}

{% endif %}

You must add more handle of page in code for each page

Example for this page: https://wildlilli.com/pages/printable-art-revolution-1 , you must add code like this:

{% if page.handle == 'landing' or 'printable-art-revolution-1' %}

{% endif %}

Add more " or ‘handle-of-your-new-page’ " for each page you want to hire header and footer

2 Likes

I almost thought we had it. Sadly, It works specifically for the page https://wildlilli.com/pages/landing, but not when I create a new page using the same landing-page template https://wildlilli.com/pages/testing-page . It would seem that code relates to the actual page and not the template. The URL with ‘landing’ is only a test page. I won’t be using that. The URL will be specific to the campaign. Hmm

Thanks @Dan-From-Ryviu . It will become a very long piece of code. :joy:

But it is workable for now and I really appreciate your help trying to solve this. :blush:

Cheers, Angela

1 Like

Most welcome

1 Like

So, if I understand correctly; removing haeder and/or footer can be done only by adding code and not by clicking remove /header/footer like on Wix pletform?