Skip to content

Instantly share code, notes, and snippets.

@carlitoescobar
Last active September 20, 2019 15:50
Show Gist options
  • Select an option

  • Save carlitoescobar/661193700b83966406c9f14ceb41e780 to your computer and use it in GitHub Desktop.

Select an option

Save carlitoescobar/661193700b83966406c9f14ceb41e780 to your computer and use it in GitHub Desktop.
General Shopify Conditionals etc.
///////////////////////////////////////////////////
// Checking for template conditional
///////////////////////////////////////////////////
<div class="content-wrapper">
{% if template == 'index' %}
{{ content_for_layout }}
{% elsif template == 'page.aboutus' %}
{{ content_for_layout }}
{% else %}
<div id="content" class="row">
{% if settings.breadcrumb %}
{% include 'breadcrumb' %}
{% endif %}
{{ content_for_layout }}
</div>
{% endif %}
</div>
///////////////////////////////////////////////////
Add blocks section
///////////////////////////////////////////////////
<div class="grid">
{% for block in section.blocks %}
<div class="grid-item">
{% case block.type %}
{% when 'first-section' %}
{% include 'snippet_first-section' %}
{% when 'second-section' %}
{% include 'snippet_second-section' %}
{% when 'third-section' %}
{% include 'snippet_third-section' %}
{% when 'fourth-section' %}
{% include 'snippet_fourth-section' %}
{% endcase %}
</div>
{% endfor %}
</div>
{% schema %}
{
"blocks": [
{
"type": "first-section",
"name": "First Section",
"settings": [
{
"id": "imageOne",
"type": "image_picker",
"label": "Image"
}
]
},
{
"type": "second-section",
"name": "Second Section",
"settings": [
{
"id": "imageOne",
"type": "image_picker",
"label": "Image"
}
]
},
{
"type": "third-section",
"name": "Third Section",
"settings": [
{
"id": "imageOne",
"type": "image_picker",
"label": "Image"
}
]
},
{
"type": "fourth-section",
"name": "Fourth Section",
"settings": [
{
"id": "imageOne",
"type": "image_picker",
"label": "Image"
}
]
}
]
}
{% endschema %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment