Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save joe-dempsey/3b8ecb06940c5d5ffb481432002ff01d to your computer and use it in GitHub Desktop.
Save joe-dempsey/3b8ecb06940c5d5ffb481432002ff01d to your computer and use it in GitHub Desktop.
section half alternating blocks
<div data-section-id="{{ section.id }}" id="mysection_{{ section.id }}" class="richtext-custom-section contain-full-width no-padding ">
{% for block in section.blocks %}
{% capture thecycle %}{% cycle 'odd', 'even' %}{% endcapture %}
{% if thecycle == 'odd' %}
<div class="odd_block">
<div class="one-half-custom odd_img ">
{% if block.settings.custom_image %}
<img src="{{ block.settings.custom_image | img_url: '2048x' }}" />
{%endif%}
</div>
<div class="one-half-custom odd_text ">
<div class="innder">
{% if block.settings.custom_rich_title %}
<h4>{{ block.settings.custom_rich_title }}</h4>
{%endif%}
{% if block.settings.custom_richtext %}
<p>{{ block.settings.custom_richtext }}</p>
{%endif%}
</div>
</div>
</div>
{% endif %}
{% if thecycle == 'even' %}
<div class="even_block">
<div class="one-half-custom even_img ">
{% if block.settings.custom_image %}
<img src="{{ block.settings.custom_image | img_url: '2048x' }}" />
{%endif%}
</div>
<div class="one-half-custom even_text ">
<div class="innder">
{% if block.settings.custom_rich_title %}
<h4>{{ block.settings.custom_rich_title }}</h4>
{%endif%}
{% if block.settings.custom_richtext %}
<p>{{ block.settings.custom_richtext }}</p>
{%endif%}
</div>
</div>
</div>
{% endif %}
{%endfor%}
</div>
{% schema %}
{
"name": "Custom Page Section",
"blocks": [
{
"type": "image",
"name": "Block Content",
"settings": [
{
"type": "text",
"id": "custom_rich_title",
"label": "Title",
"default": "Enter Title"
},
{
"type": "richtext",
"id": "custom_richtext",
"label": "Text",
"default": "<p>Enter Text</p>"
},
{
"type": "image_picker",
"id": "custom_image",
"label": "Image"
}
]
}
],
"presets": [
{
"name": "Custom Page Section",
"category": "Image"
}
]
}
{% endschema %}
{% stylesheet %}
{% endstylesheet %}
{% javascript %}
{% endjavascript %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment