How To Display The Footer Only On The Home Page

Solved

How To Display The Footer Only On The Home Page

KhallP
Excursionist
63 0 11

I want to remove the footer from all pages and leave it only on the home page, can anyone help me?

Accepted Solution (1)

Made4uo-Ribe
Shopify Partner
8202 1972 2409

This is an accepted solution.

Hi @KhallP 

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>
   footer.footer.color-background-1.gradient.section-sections--16302501757028__footer-padding {
    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 is highly appreciated. Coffee tips fuels my dedication.
Get EXPERIENCED Shopify developers at affordable rates—visit Made4Uo.com for quick quote!
Do not lost your Shopify store! Get FREE trial with ✔️ Rewind Backup: Automatic, reliable, stress-free.
Need THEME UPDATES but has custom codes? No worries, contact us for affordable price.

View solution in original post

Replies 3 (3)

TaskHusky
Shopify Partner
112 11 17

Hello @KhallP - 

 

Zach from TaskHusky here. 

Here are some general instructions on how to accomplish this:

Access Your Theme Files:


From your Shopify admin, go to Online Store > Themes.

Find the theme you want to edit, and then click Actions > Edit code.

Locate the Footer Code:


The footer code might be in different files depending on the theme. Commonly, it is in theme.liquid, footer.liquid (inside the sections folder), or theme.liquid might include it from another file using a {% include %} or {% section %} tag. Look for the code that is responsible for displaying the footer.

Edit the Code:


Once you've found where the footer is included, wrap the footer code or the include/section tag that loads the footer with an if statement that checks if the current page is the homepage. You can check if it's the homepage by using request.path or template object like this:

liquid

Copy code

{% if request.path == '/' %}
<!-- Footer code or include/section tag goes here -->
{% endif %}

Or, using the template object:


liquid
Copy code

{% if template.name == 'index' %}
<!-- Footer code or include/section tag goes here -->
{% endif %}

Save the Changes:


After adding the conditional statement around the footer code, save your changes.

Test the Change:

 

Go to your storefront and refresh the page to ensure that the footer only appears on the homepage and not on other pages.

Zachary McClung, founder
Your Shopify Store Customized Your Way - 20,000 + Shopify Merchants Served
Clean Size Chart - Reduce Returns & Make More Money

Made4uo-Ribe
Shopify Partner
8202 1972 2409

This is an accepted solution.

Hi @KhallP 

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>
   footer.footer.color-background-1.gradient.section-sections--16302501757028__footer-padding {
    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 is highly appreciated. Coffee tips fuels my dedication.
Get EXPERIENCED Shopify developers at affordable rates—visit Made4Uo.com for quick quote!
Do not lost your Shopify store! Get FREE trial with ✔️ Rewind Backup: Automatic, reliable, stress-free.
Need THEME UPDATES but has custom codes? No worries, contact us for affordable price.

BrainStation23
Shopify Partner
406 60 58

 HI @KhallP 
You can try this step to achieve your result 
Step 1: You need to change your footer.liquid file code 

222.png
This is your previous code looks like this 
and your output is 
111.png
Step 2: But if you change some code like this
Just add one condition 


333.png 
After doing this the result is 

444.png

Code:

{% if request.path == routes.root_url %}
<footer></footer>

{% endif %}


Joy Matubber| Brain Station 23
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more contact us : [email protected]


Brain Station 23 PLC (Mail: [email protected])
- Was your question answered? Mark it as an Accepted Solution
- Did the solution not address your concern? We kindly request that share or mail your store URL with us this will enable us to collaborate more closely.
- Explore our Shopify public apps