Shopify themes, liquid, logos, and UX
Hello,
I want to add this Logo Slider Section to home page.
https://codepen.io/tanna261990/pen/oNWNVGY
Where need to add the HTML, CSS, and JS file ?
I'm using the Kalles theme.
Thanks.
You can create a new section and add all the code inside that section. You can take reference from the other sections built from your theme code editor.
Make sure to add a preset, this way you can add your section on any page you want and also choose where to show it by dragging and dropping.
Can you explain more please?
where to create a new section? in edit code?
And where should I put the code? There are 3 different codes
HTML, CSS and JS.
Thanks
Yes click edit code, create a new section name it anything you want. Then add the code.
So for html just add it above the code that you get the first time you create a section.
For css add a tag<style> your css code</style> above the html.
For js add your code within a script tag <script> your js code</script> and place it at the very bottom or below html.
Now the code that you got at the very start from Shopify make sure you add the name of the section to name field and the presets field within the schema. This will allow you to add the section from the customizer.
Look at other sections made for reference.
Hey @Elailll,
I've got the solution for adding that logo slider to your Kalles theme homepage! I've broken everything down into simple steps so you can implement it easily.
First, you'll need to create a new section file:
<div class="container"> <h2>Logos <b>Slider</b></h2> <hr> <section class="logos-slider slider"> {% for block in section.blocks %} <div class="slide"> <img src="{{ block.settings.logo_image | img_url: 'master' }}" alt="{{ block.settings.logo_alt }}"> </div> {% endfor %} </section> <hr> </div> {% schema %} { "name": "Logo Slider", "settings": [ { "type": "text", "id": "title", "label": "Heading", "default": "Logos Slider" } ], "blocks": [ { "type": "logo", "name": "Logo", "settings": [ { "type": "image_picker", "id": "logo_image", "label": "Logo Image" }, { "type": "text", "id": "logo_alt", "label": "Image Alt Text", "default": "Brand Logo" } ] } ], "presets": [ { "name": "Logo Slider", "category": "Custom Content", "blocks": [ { "type": "logo" }, { "type": "logo" }, { "type": "logo" }, { "type": "logo" } ] } ] } {% endschema %}
Next, let's add the CSS:
.logo-slider-section h2 { text-align: center; padding: 20px; text-transform: uppercase; } .logo-slider-section b { color: red; } /* Slider */ .logos-slider .slick-slide { margin: 0px 20px; } .logos-slider .slick-slide img { width: 100%; } .slick-list { position: relative; display: block; overflow: hidden; margin: 0; padding: 0; } .slick-list:focus { outline: none; } .slick-list.dragging { cursor: pointer; cursor: hand; } .slick-slider .slick-track, .slick-slider .slick-list { -webkit-transform: translate3d(0, 0, 0); -moz-transform: translate3d(0, 0, 0); -ms-transform: translate3d(0, 0, 0); -o-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); } .slick-track { position: relative; top: 0; left: 0; display: block; } .slick-track:before, .slick-track:after { display: table; content: ''; } .slick-track:after { clear: both; } .slick-loading .slick-track { visibility: hidden; } .slick-slide { display: none; float: left; height: 100%; min-height: 1px; } [dir='rtl'] .slick-slide { float: right; } .slick-slide img { display: block; } .slick-slide.slick-loading img { display: none; } .slick-slide.dragging img { pointer-events: none; } .slick-initialized .slick-slide { display: block; } .slick-loading .slick-slide { visibility: hidden; } .slick-vertical .slick-slide { display: block; height: auto; border: 1px solid transparent; } .slick-arrow.slick-hidden { display: none; }
Now for the Javascript:
$(document).ready(function(){ $('.logos-slider').slick({ slidesToShow: 4, slidesToScroll: 1, autoplay: true, autoplaySpeed: 1500, arrows: false, dots: false, pauseOnHover: false, responsive: [{ breakpoint: 768, settings: { slidesToShow: 3 } }, { breakpoint: 520, settings: { slidesToShow: 2 } }] }); });
Finally, we need to link everything together:
{% if template contains 'index' %} {{ 'logo-slider.css' | asset_url | stylesheet_tag }} {% if settings.use_jquery %} <!-- jQuery is likely already included in Kalles theme --> {% else %} <script src="https://code.jquery.com/jquery-3.6.0.min.js" type="text/javascript"></script> {% endif %} <script src="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.min.js" defer></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/slick-carousel/1.6.0/slick.min.css"> <script src="{{ 'logo-slider.js' | asset_url }}" defer></script> {% endif %}
Last step - add the section to your homepage:
Let me know if you need any help implementing this!
Cheers,
Shubham | Untechnickle
Helping for free: hello@untechnickle.com
Don't forget to say thanks, it'll make my day - just send me an email!
Get Revize for Free | Let your shoppers edit orders post-purchase | Get Zero Support Tickets | #1 Order Editing + Upsell App
I did it but it's not good
Why is it vertical and not horizontal?
I want it to be like this.
There might be some theme CSS conflicting with this code! Would it be possible for you to share your collaborator code over email or DM? We'll send you the store access request and fix this!
Looking forward to hearing from you,
Shubham | Untechnickle
Helping for free: hello@untechnickle.com
Don't forget to say thanks, it'll make my day - just send me an email!
Get Revize for Free | Let your shoppers edit orders post-purchase | Get Zero Support Tickets | #1 Order Editing + Upsell App
Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025Discover opportunities to improve SEO with new guidance available from Shopify’s growth...
By Jacqui May 1, 2025