How can I add a logo list section to my homepage using Dawn theme?

Solved

How can I add a logo list section to my homepage using Dawn theme?

KC14
Explorer
66 0 29

Hello everyone,

 

I would like to add a Logo List Section on my Homepage. If someone can help me code the section, it would be appreciated 🙂

 

I am using Dawn Theme by the way.

 

Thank you!

Accepted Solution (1)
made4Uo
Shopify Partner
3845 717 1189

This is an accepted solution.

Hi @KC14,

 

You can try the code below.  Create a section in your Dawn theme. For more information, you can check here

 

Section Code

<div class="logoList--container page-width" style="padding-top: {{ section.settings.padding_top | append: "px" }}; padding-bottom: {{ section.settings.padding_bottom | append: "px" }}">
<h2 class="h1">{{ section.settings.title | escape }}</h2>
  <ul>
    {%- for block in section.blocks -%}
      <li class="logoList--item" {{ block.shopify_attributes }}>
        {%- if block.settings.link != blank -%}
          <a href="{{ block.settings.link }}">
        {%- endif -%}
          {%- if block.settings.image != blank -%}
            {{ block.settings.image | img_url: '160x160', scale: 2 | img_tag: block.settings.image.alt }}
          {%- else -%}
            {{ 'logo' | placeholder_svg_tag: 'placeholder-svg' }}
          {%- endif -%}
        {%- if block.settings.link != blank -%}
          </a>
        {%- endif -%}
      </li>
    {%- endfor -%}
  </ul>

</div>
<style>
  .logoList--container {
    padding-top: 20px;
    padding-bottom: 20px;
    margin: auto;
  }

 .logoList--container ul {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    justify-content: center;
}
  
  .logoList--item{
    display: inline-block;
    max-width: {{ section.settings.logo_width }};
  }

   .logoList--item img{
    width: 100%;
   }
</style>

{% schema %}
{
  "name": "Logo list",
  "settings": [
    {
      "type": "text",
      "id": "title",
      "label": "Heading",
      "default": "Logo list"
    },
    {
      "type": "select",
      "id": "logo_width",
      "label": "Logo width",
      "default": "160px",
      "options": [
        {
          "label": "Extra Small",
          "value": "50px"
        },
        {
          "label": "Small",
          "value": "100px"
        },
        {
          "label": "Medium",
          "value": "160px"
        },
        {
          "label": "Large",
          "value": "200px"
        },
        {
          "label": "Extra Large",
          "value": "400px"
        }
      ]
    },
    {
      "type": "range",
      "id": "padding_top",
      "min": 0,
      "max": 100,
      "step": 2,
      "default": 20,
      "label": "Padding top"
    },
    {
      "type": "range",
      "id": "padding_bottom",
      "min": 0,
      "max": 100,
      "step": 2,
      "default": 20,
      "label": "Padding bottom"
    }
  ],
  "blocks": [
    {
      "type": "logo_image",
      "name": "Logo",
      "settings": [
        {
          "type": "image_picker",
          "id": "image",
          "label": "Image"
        },
        {
          "type": "url",
          "id": "link",
          "label": "Link",
          "info": "Optional"
        }
      ]
    }
  ],
  "presets": [
    {
      "name": "Logo list",
      "category": "Image",
      "blocks": [
        {
          "type": "logo_image"
        },
        {
          "type": "logo_image"
        },
        {
          "type": "logo_image"
        },
        {
          "type": "logo_image"
        }
      ]
    }
  ]
}
{% endschema %}

 

If this fixed your issue Likes and Accept as Solution is highly appreciated. Coffee tips fuels my dedication.
Get EXPERIENCED Shopify developers at affordable rates—visit Made4Uo.com for quick quote!
Do not lost your Shopify store! Get FREE trial with ✔️ Rewind Backup: Automatic, reliable, stress-free

View solution in original post

Replies 12 (12)

SpeedyDev
Trailblazer
199 17 39

@KC14 

try out this code.

<style>
  .logo-bar__item {
    display: inline-block;
    max-width: {{ section.settings.logo_width }};
  }
</style>

<h2>{{ section.settings.title | escape }}</h2>

{%- if section.blocks.size > 0 -%}
  <ul>
    {%- for block in section.blocks -%}
      <li class="logo-bar__item" {{ block.shopify_attributes }}>
        {%- if block.settings.link != blank -%}
          <a href="{{ block.settings.link }}">
        {%- endif -%}

          {%- if block.settings.image != blank -%}
            {{ block.settings.image | img_url: '160x160', scale: 2 | img_tag: block.settings.image.alt }}
          {%- else -%}
            {{ 'logo' | placeholder_svg_tag: 'placeholder-svg' }}
          {%- endif -%}

        {%- if block.settings.link != blank -%}
          </a>
        {%- endif -%}
      </li>
    {%- endfor -%}
  </ul>
{%- endif -%}

{% schema %}
{
  "name": "Logo list",
  "class": "index-section",
  "max_blocks": 10,
  "settings": [
    {
      "type": "text",
      "id": "title",
      "label": "Heading",
      "default": "Logo list"
    },
    {
      "type": "select",
      "id": "logo_width",
      "label": "Logo width",
      "default": "160px",
      "options": [
        {
          "label": "Extra Small",
          "value": "100px"
        },
        {
          "label": "Small",
          "value": "125px"
        },
        {
          "label": "Medium",
          "value": "160px"
        },
        {
          "label": "Large",
          "value": "175px"
        },
        {
          "label": "Extra Large",
          "value": "200px"
        }
      ]
    }
  ],
  "blocks": [
    {
      "type": "logo_image",
      "name": "Logo",
      "settings": [
        {
          "type": "image_picker",
          "id": "image",
          "label": "Image"
        },
        {
          "type": "url",
          "id": "link",
          "label": "Link",
          "info": "Optional"
        }
      ]
    }
  ],
  "presets": [
    {
      "name": "Logo list",
      "category": "Image",
      "blocks": [
        {
          "type": "logo_image"
        },
        {
          "type": "logo_image"
        },
        {
          "type": "logo_image"
        },
        {
          "type": "logo_image"
        }
      ]
    }
  ]
}
{% endschema %}

 

banned
KC14
Explorer
66 0 29

Hey @SpeedyDev ,

 

Thank you for replying, it added the Logo List! 

 

But as you can see in the screenshot, the logos appear really big and close to each other on the leftside. Any idea how to fix that?

 

Thank you!

 

KC14_0-1657957117766.png

made4Uo
Shopify Partner
3845 717 1189

This is an accepted solution.

Hi @KC14,

 

You can try the code below.  Create a section in your Dawn theme. For more information, you can check here

 

Section Code

<div class="logoList--container page-width" style="padding-top: {{ section.settings.padding_top | append: "px" }}; padding-bottom: {{ section.settings.padding_bottom | append: "px" }}">
<h2 class="h1">{{ section.settings.title | escape }}</h2>
  <ul>
    {%- for block in section.blocks -%}
      <li class="logoList--item" {{ block.shopify_attributes }}>
        {%- if block.settings.link != blank -%}
          <a href="{{ block.settings.link }}">
        {%- endif -%}
          {%- if block.settings.image != blank -%}
            {{ block.settings.image | img_url: '160x160', scale: 2 | img_tag: block.settings.image.alt }}
          {%- else -%}
            {{ 'logo' | placeholder_svg_tag: 'placeholder-svg' }}
          {%- endif -%}
        {%- if block.settings.link != blank -%}
          </a>
        {%- endif -%}
      </li>
    {%- endfor -%}
  </ul>

</div>
<style>
  .logoList--container {
    padding-top: 20px;
    padding-bottom: 20px;
    margin: auto;
  }

 .logoList--container ul {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    justify-content: center;
}
  
  .logoList--item{
    display: inline-block;
    max-width: {{ section.settings.logo_width }};
  }

   .logoList--item img{
    width: 100%;
   }
</style>

{% schema %}
{
  "name": "Logo list",
  "settings": [
    {
      "type": "text",
      "id": "title",
      "label": "Heading",
      "default": "Logo list"
    },
    {
      "type": "select",
      "id": "logo_width",
      "label": "Logo width",
      "default": "160px",
      "options": [
        {
          "label": "Extra Small",
          "value": "50px"
        },
        {
          "label": "Small",
          "value": "100px"
        },
        {
          "label": "Medium",
          "value": "160px"
        },
        {
          "label": "Large",
          "value": "200px"
        },
        {
          "label": "Extra Large",
          "value": "400px"
        }
      ]
    },
    {
      "type": "range",
      "id": "padding_top",
      "min": 0,
      "max": 100,
      "step": 2,
      "default": 20,
      "label": "Padding top"
    },
    {
      "type": "range",
      "id": "padding_bottom",
      "min": 0,
      "max": 100,
      "step": 2,
      "default": 20,
      "label": "Padding bottom"
    }
  ],
  "blocks": [
    {
      "type": "logo_image",
      "name": "Logo",
      "settings": [
        {
          "type": "image_picker",
          "id": "image",
          "label": "Image"
        },
        {
          "type": "url",
          "id": "link",
          "label": "Link",
          "info": "Optional"
        }
      ]
    }
  ],
  "presets": [
    {
      "name": "Logo list",
      "category": "Image",
      "blocks": [
        {
          "type": "logo_image"
        },
        {
          "type": "logo_image"
        },
        {
          "type": "logo_image"
        },
        {
          "type": "logo_image"
        }
      ]
    }
  ]
}
{% endschema %}

 

If this fixed your issue Likes and Accept as Solution is highly appreciated. Coffee tips fuels my dedication.
Get EXPERIENCED Shopify developers at affordable rates—visit Made4Uo.com for quick quote!
Do not lost your Shopify store! Get FREE trial with ✔️ Rewind Backup: Automatic, reliable, stress-free
KC14
Explorer
66 0 29

Hi @made4Uo ,

 

Thank you, that's a much better looking Logo List!

 

Appreciate your help 🙂

Outdoors
Shopify Partner
2 0 2

I'm using a different Theme (Ride) and this code worked for me.  But, I need a different background color.  Is there a way to add a selector for "Color Scheme" so that I can choose the same as other sections?

riyanne
Shopify Partner
1 0 0

Love this! Set it to appear 8 logo in one section. All looks good in desktop but the mobile view can be improved. 

Can you help me out? 

riyanne_0-1663503067996.png

https://theecoshift.online/

stephcross
Tourist
4 0 1

Hi @made4Uo 

This is great and it did the trick for me. Just wondering how I would go about adding the background colour option to this new section? 

lauren310
New Member
7 0 0

This worked perfectly but why is mine showing logo and not the actual image? 

Momokoko
Visitor
1 0 0

May I know how to make the section in the middle of the screen?微信截图_20230903173110.png

valholden02
Shopify Partner
7 0 0

This code worked great for me!

 

Is there an extra line of code that will help it scroll right on mobile? 

 

My site (with code already in use on homepage): https://valholden.myshopify.com/

 

Example logo list I'd like to emulate (at bottom of site): thistlefarms.org 

RC94
Excursionist
33 1 9

Is there a way to make the logo list Centered as well? I only have one that I would like in the center, but it is showing on the left. Help would be appreciated!

Brad101
Visitor
1 0 2

Hey mate

Ive added this however the logo list of off centre (to the right) on mobile view. Is there an easy fix to that?