Jump to content

change logo in ONLY product pages

Recommended Posts

2 hours ago, Alpi87 said:

Site URL: https://www.murmali.com/shop/cork-bucket-gamma-natural

Hi there! I am trying to change the logo in only my product pages (all of them). The logo from the product pages is automatically taken from the shop page. How can I change the logo in product pages while keeping the logo in the shop page? 

Thanks! 

There is class name in product page for body, if you want logo in black on shop just use this

body.collection-type-products .Header-branding img {
  filter: invert(1);
}

image.png.89f8c3dddeac93bdcf75510425140c83.png

Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Lightbox Studio plugin
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to comment

Hi bangank36, thank you for your reply. I knew this already and it does the job. However, for some reason the effect of the filter in my white logo is not very good. In some desktop screens it appears thicker and kind of blurry. When I change the logo in the shop page to the black logo, in the product pages it appears perfect. That's why I need to change the logo and not just apply a filter on the one taken from the shop page.

I know that with the following code I can change the logo in any page of the site (except for the  product pages)

<script> window.onload = function() { document.getElementsByClassName('Header-branding-logo')[0].src = 'URL'; } </script>

However I do not know how to target just the logo in the product pages...

 

Edited by Alpi87
spelling mistake
Link to comment
<script> window.onload = function() { document.querySelector('body.collection-type-products .Header-branding-logo')[0].src = 'URL'; } </script>

.collection-type-products is the class of product page body

Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Lightbox Studio plugin
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to comment
6 minutes ago, Alpi87 said:

It does not work... I have tried targeting "body.collection-type-products .Header-branding-logo" and "body.collection-type-products .Header-branding img" and it still does not work.

 

It's my bad

<script> window.onload = function() { document.querySelector('body.collection-type-products .Header-branding-logo').src = 'URL'; } </script>

 

Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Lightbox Studio plugin
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to comment
5 minutes ago, Alpi87 said:

When I put that code it changes the logo in all product pages but also in the shop page... 

<script> 
  window.onload = function() { 
    var logo = document.querySelector('body.collection-type-products:not(#collection-5ebae83d182f400f38e71560) .Header-branding-logo');
    
    if (logo) {
    	logo.src = 'URL'; 
    }
  } 
</script>

This will exclude the shop, let me know, thanks

Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Lightbox Studio plugin
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.