Shopify themes, liquid, logos, and UX
Hi, I have been trying to create a custom section to select between HTML, text, videos, and images along with custom width and making it dynamic. I am unable to do it. Can you please help? I was able to do it for texts.
<div id="section-test">
<div class="wrapper">
<div class="grid-uniform">
{% case section.blocks.size %}
{% when 0 %}
{% when 1 %}
{% assign column_width = 'text-center' %}
{% when 2 %}
{% assign column_width = 'post-large--one-half medium--one-half' %}
{% when 3 %}
{% assign column_width = 'post-large--one-third medium--one-third' %}
{% when 4 %}
{% assign column_width = 'post-large--one-quarter medium--one-half' %}
{% when 5 %}
{% assign column_width = 'post-large--one-fifth medium--one-half' %}
{% when 6 %}
{% assign column_width = 'post-large--one-sixth medium--one-half' %}
{% endcase %}
{% for block in section.blocks %}
{% case block.type %}
{% when 'text' %}
<div class="grid__item {{ column_width }}">
<h3 class="h4">{{ block.settings.title }}</h3>
<div class="rte">{{ block.settings.richtext }}</div>
</div>
{% endcase %}
{% endfor %}
</div>
</div>
</div>
{% schema %}
{
"name": "Test Custom",
"max_blocks": 6,
"blocks": [
{
"type": "text",
"name": "Text",
"settings": [
{
"type": "text",
"id": "title",
"label": "Text",
},
{
"type": "richtext",
"id": "richtext",
"label": "Text"
}
]
}
{% endschema %}
Solved! Go to the solution
This is an accepted solution.
sorry for any issue
you can try this way
http://www.codeshopify.com/blog_posts/shopify-sections-with-dynamic-blocks
This is an accepted solution.
sorry for any issue
you can try this way
http://www.codeshopify.com/blog_posts/shopify-sections-with-dynamic-blocks
Are you ready to take your business to the next level? Look no further than the latest ...
By SarahF_Shopify Apr 15, 2024We’re keeping the ball rolling to make sure you’re always ahead of the game. So buckle ...
By JasonH Apr 8, 2024Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024