New Shopify Certification now available: Liquid Storefronts for Theme Developers

homepage header

FWF
New Member
4 0 0

hi all,

im using a code to add an image to my header. how can i exclude my homepage from this code? also how can i change the color of my font on my homepage header without it effecting all my other pages?

 

 

Replies 6 (6)
FWF
New Member
4 0 0

this is the code im using

 

.header {
background: url(https://cdn.shopify.com/s/files/1/0736/1419/7046/files/212Why_Choose_Us_Travel_Agency_6.png?v=169527...);
background-repeat: no-repeat;
background-position: center;
background-size: cover;
}

Dan-From-Ryviu
Shopify Partner
5673 1044 1071

Hi @FWF 

You can use this code in theme.liquid file to check page is homepage so you can apply code to homepage only or not apply code to homepage 

{% if template == 'index' %}

{% endif %}

- Helpful? Like and Accept a solution. - Donate: Buy coffee - or Paypal me ❤️
- Ryviu - Product Reviews app, collect consumer photo reviews, import reviews from AliExpress, Amazon, Etsy, Shoppe and Walmart and CSV.
- Lookfy app: Create Image Lookbook, Photo Gallery with product hotspots
- Enjoy 3 months of Shopify for $1/month. Sign up now

FWF
New Member
4 0 0

what can i add in the middle of that code to say no or false or something? 

Dan-From-Ryviu
Shopify Partner
5673 1044 1071
{% if template == 'index' %}
// this is homepage
{% else %}
// this is not homepage
{% endif %}

- Helpful? Like and Accept a solution. - Donate: Buy coffee - or Paypal me ❤️
- Ryviu - Product Reviews app, collect consumer photo reviews, import reviews from AliExpress, Amazon, Etsy, Shoppe and Walmart and CSV.
- Lookfy app: Create Image Lookbook, Photo Gallery with product hotspots
- Enjoy 3 months of Shopify for $1/month. Sign up now

FWF
New Member
4 0 0

something like this

 

{% if header == 'index' %}
background:
false
{% endif %}

Dan-From-Ryviu
Shopify Partner
5673 1044 1071
{% if template == 'index' %}
// this is homepage - you must add css code into style tags
<style>
</style>
{% else %}
// this is not homepage - you must add css code into style tags
<style>
</style>
{% endif %}

- Helpful? Like and Accept a solution. - Donate: Buy coffee - or Paypal me ❤️
- Ryviu - Product Reviews app, collect consumer photo reviews, import reviews from AliExpress, Amazon, Etsy, Shoppe and Walmart and CSV.
- Lookfy app: Create Image Lookbook, Photo Gallery with product hotspots
- Enjoy 3 months of Shopify for $1/month. Sign up now