Skip to content

Instantly share code, notes, and snippets.

@stewartknapman
Created November 21, 2013 21:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stewartknapman/7590121 to your computer and use it in GitHub Desktop.
Save stewartknapman/7590121 to your computer and use it in GitHub Desktop.
Shopify Liquid template that wraps looped items in a row on every third or fourth iteration.
{% assign thumbs_per_row = settings.thumbnails-per-row | times:1 %}
{% if forloop.length > thumbs_per_row %}
{% assign mod = forloop.index | modulo:thumbs_per_row %}
{% if mod == 0 %}</div><div class="row">{% endif %}
{% endif %}
<div class="row">
{% for item in loop %}
{% include '_item' with item %}
{% include '_end_row' %}
{% endfor %}
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment