Help Needed - How to make different Logo appear every time a page is refreshed?

Tourist
36 0 1

Anyone know how to get a logo image in Debut Theme to change to a different logo image, on every page and when a page is refreshed?

0 Likes
Shopify Expert
2514 423 533

HI @bcfranc 

If you want to change logo on all pages then you have to code it in section->header.liquid file.

you have to use condition like this:

{% if template contains 'index' %}
    //logo for home page
{% elsif template contains 'product ' %}
    //logo for product page
{% else %}
   //common logo
{%endif%}
Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: jasoliyabrijesh123@gmail.com
Skype: jasoliya.brijesh
Want to get Free review and advice for sale on store ?? just text me here
0 Likes
Tourist
36 0 1

Thanks for the tip @Jasoliya.

 

Does this code allow for a different logo on every page of the Debut Theme?

 

How do I specify which logo image is used per page?

0 Likes
Shopify Expert
2514 423 533

You have to add your logo image in this given condition like bellow:

{% if template contains 'index' %}
    <img src="home_page_logo_url">
{% elsif template contains 'product ' %}
    <img src="product_page_logo_url">
{% else %}
   <img src="common_page_logo_url">
{%endif%}

 

Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: jasoliyabrijesh123@gmail.com
Skype: jasoliya.brijesh
Want to get Free review and advice for sale on store ?? just text me here
0 Likes
Tourist
36 0 1

Cool, thanks for the info @Jasoliya.

 

Can the logo be changed every time the page is refreshed?

 

What would the code for that look like?

0 Likes
Shopify Expert
2514 423 533

No logo will not change on page refresh it just for different logo on different pages. if you want to change different log on different page + different logo on page refresh then you have to do it by Js code. 

Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: jasoliyabrijesh123@gmail.com
Skype: jasoliya.brijesh
Want to get Free review and advice for sale on store ?? just text me here
0 Likes
Tourist
36 0 1

Ok, noted @Jasoliya.

 

What code should I insert into the Debut Theme for the logo to change with every page refresh?

0 Likes
Shopify Expert
2514 423 533

That exact  code i cant send you as its not simple but i can suggest you that how you do it. you can create on array with Js and add your all logo in array then on page load get random logo from this array and show on logo in header.

 

Want to modify or custom changes on store hire me.
If helpful then please Like and Accept Solution.
Email: jasoliyabrijesh123@gmail.com
Skype: jasoliya.brijesh
Want to get Free review and advice for sale on store ?? just text me here
0 Likes
Tourist
36 0 1

Great, that helps @Jasoliya. Thanks for the suggestion!

0 Likes
Shopify Expert
665 170 199

Hi, @bcfranc ,

This is Evita from On The Map.

 

It's actually quite easy code:

 

// Your logo URL's
const logos = ['https://cdn.mos.cms.futurecdn.net/BVb3Wzn9orDR8mwVnhrSyd.jpg', 'https://images.fastcompany.net/image/upload/w_596,c_limit,q_auto:best,f_auto/fc/3034007-inline-i-applelogo.jpg', 'https://dynamic.brandcrowd.com/asset/logo/d68dfd75-aeba-43c1-9f11-25702e971329/logo?v=4'];

// Gets random logo of your array
const randomLogo = Math.floor(Math.random()*logos.length);

// Sets the new logo.
document.querySelector('.site-header__logo-image img').src=logos[randomLogo];

 

You can set as many logos as you want.

 

Best, Evita

On The Map Marketing | Developing custom Shopify Sites & Apps is our thing

- Install our latest app Accessibly - Makes your store accessible for everyone, helps to avoid fines
- Inc 5000 | Shopify Parners | 20+ stores launched | 300+ active clients
- Need help with your Shopify store? Reach out to us!
0 Likes