How to change custom image of button.

Solved

How to change custom image of button.

cureblame
Excursionist
35 0 4

With my past developers we were able to create a button that switches from light mode to dark mode. I now want to change the image of the button. I've looked through base css and theme liquid to see if there was any "img src" that I could just change the url, but I haven't found it. Please help me change this candle image on the button

URL: https://cureblame.com/collections/all#

password:shhhbequiet

Screenshot 2024-05-29 215728.pngScreenshot 2024-05-29 215639.png

Accepted Solution (1)

theycallmemakka
Shopify Partner
1795 436 465

This is an accepted solution.

Hi @cureblame ,

 

The code needs to be updated on global.js

 

Thank you

Support Me: Buy me a Coffee


For quick response - Message Me


Ping me at: theycallmemakka@gmail.com

View solution in original post

Replies 8 (8)

suyash1
Shopify Partner
10711 1324 1699

@cureblame - it is announcement bar section, so go to your theme files and check if you have separate section file like announcement-bar.liquid or announcement.liquid etc, you can search by name

Support me | To build shopify pages use PAGEFLY | Contact me - suyash.patankar@gmail.com , My timezone is GMT+5:30.
cureblame
Excursionist
35 0 4

I don't see the img src or way to change the img on announcement-bar-liquid, here's the code

{%- for block in section.blocks -%}
  {%- case block.type -%}
    {%- when 'announcement' -%}
      <div class="announcement-bar color-{{ block.settings.color_scheme }} gradient" role="region" aria-label="{{ 'sections.header.announcement' | t }}" {{ block.shopify_attributes }}>
        {%- if block.settings.text != blank -%}
          {%- if block.settings.link != blank -%}
            <a href="{{ block.settings.link }}" class="announcement-bar__link link link--text focus-inset animate-arrow">
          {%- endif -%}
          <div class="page-width">
          <a href="#" class="darkmode-button" id="dmbutton"></a> 
        
            
              <p class="announcement-bar__message h5">
                {{ block.settings.text | escape }}
                {%- if block.settings.link != blank -%}
                  {% render 'icon-arrow' %}
                {%- endif -%}
              </p>
          </div>
          {%- if block.settings.link != blank -%}
            </a>
          {%- endif -%}
        {%- endif -%}
      </div>
  {%- endcase -%}
{%- endfor -%}

{% schema %}
{
  "name": "t:sections.announcement-bar.name",
  "max_blocks": 12,
  "blocks": [
    {
      "type": "announcement",
      "name": "t:sections.announcement-bar.blocks.announcement.name",
      "settings": [
        {
          "type": "textarea",
          "id": "text",
          "default": "Welcome to our store",
          "label": "t:sections.announcement-bar.blocks.announcement.settings.text.label"
        },
        {
          "type": "select",
          "id": "color_scheme",
          "options": [
            {
              "value": "accent-1",
              "label": "t:sections.all.colors.accent_1.label"
            },
            {
              "value": "accent-2",
              "label": "t:sections.all.colors.accent_2.label"
            },
            {
              "value": "background-1",
              "label": "t:sections.all.colors.background_1.label"
            },
            {
              "value": "background-2",
              "label": "t:sections.all.colors.background_2.label"
            },
            {
              "value": "inverse",
              "label": "t:sections.all.colors.inverse.label"
            }
          ],
          "default": "accent-1",
          "label": "t:sections.all.colors.label"
        },
        {
          "type": "url",
          "id": "link",
          "label": "t:sections.announcement-bar.blocks.announcement.settings.link.label"
        }
      ]
    }
  ],
  "default": {
    "blocks": [
      {
        "type": "announcement"
      }
    ]
  }
}
{% endschema %}

 

 

suyash1
Shopify Partner
10711 1324 1699

@cureblame - this line -  <a href="#" class="darkmode-button" id="dmbutton"></a> 

 

it gets image and since image code is not directly present in file, it must have been fetched from some javascript file, I recommend you to ask to theme developers about this, also check theme settings in customize settings

Support me | To build shopify pages use PAGEFLY | Contact me - suyash.patankar@gmail.com , My timezone is GMT+5:30.
cureblame
Excursionist
35 0 4

I don't work with the old theme developers anymore, so I can't contact them. Is there anyway to change it manually? 

suyash1
Shopify Partner
10711 1324 1699

@cureblame - then need to go through code and check from where the image is been fetched

Support me | To build shopify pages use PAGEFLY | Contact me - suyash.patankar@gmail.com , My timezone is GMT+5:30.
cureblame
Excursionist
35 0 4

Which files do you recommend me to check?

suyash1
Shopify Partner
10711 1324 1699

@cureblame - javascript files , this will not be easy, but you can check them

Support me | To build shopify pages use PAGEFLY | Contact me - suyash.patankar@gmail.com , My timezone is GMT+5:30.

theycallmemakka
Shopify Partner
1795 436 465

This is an accepted solution.

Hi @cureblame ,

 

The code needs to be updated on global.js

 

Thank you

Support Me: Buy me a Coffee


For quick response - Message Me


Ping me at: theycallmemakka@gmail.com