How can I add images to grandchild links in the Impulse theme?

Hello,

I am using impulse theme and I want to add image to the grand child links.

{%- for grandchildlink in childlink.links -%}

{%- if grandchildlink.icon -%} {%- endif -%} {{ grandchildlink.title }}
{%- endfor -%}

i have written this code but don’t know what to do next.
I have attach screenshot i want to show image like this.

Hey @Basit7

First, you need to add images to your links. Shopify doesn’t natively support adding images to link lists, so you’ll need to use a workaround. You can upload your images to the Shopify admin then add the image URLs to your links as tags. For example, you can add a tag like icon:

https://your-shopify-store.com/path/to/image.jpg

to your links.

Next, you need to modify your theme’s Liquid code to display these images. In your theme.liquid file (or the relevant section file), find the code for your grandchild links. It might look something like this:

{% for grandchildlink in childlink.links %}
  
    {{ grandchildlink.title }}
  
{% endfor %}

Modify this code to check for an icon tag and display the image:

{% for grandchildlink in childlink.links %}
  
    {% for tag in grandchildlink.tags %}
      {% if tag contains 'icon:' %}
        {% assign icon_url = tag | remove: 'icon:' %}
        
      {% endif %}
    {% endfor %}
    
      {{ grandchildlink.title }}
    
  

{% endfor %}

This code will look for an icon tag in your grandchild links, extract the image URL from the tag, and display the image.

Remember to always make a backup of your theme before making any changes. If you’re not comfortable with coding, consider hiring a Shopify expert to help you with these changes.

1 Like

Thanks azamgill,

what if i use meta objects for the image?
for example like this code