wickywills
9/14/2017 - 1:28 PM

Split items loop into two parts

For a project, I had to split the Wordpress posts so that there were 4 items before a horizontal banner, and the rest of the items after the banner, like so:

{% for subCatItem in subCatItems|slice(0,4) %}
    {% include 'components/page/sub-cat-item' with subCatItem %}
{% endfor %}
</div>

[SOMETHING SPLITTING THE POSTS]

{% for subCatItem in subCatItems|slice(4,16) %}
    {% include 'components/page/sub-cat-item' with subCatItem %}
{% endfor %}