Skip to content

Instantly share code, notes, and snippets.

@iainurquhart
Created December 1, 2014 23:45
Show Gist options
  • Save iainurquhart/fd35da453e2b07d5ff6d to your computer and use it in GitHub Desktop.
Save iainurquhart/fd35da453e2b07d5ff6d to your computer and use it in GitHub Desktop.
batch filters in twig
{% for profileRow in entry.teamProfiles|batch(4) %}
<div class="row team_members_wrapper">
{% for profile in profileRow %}
<div class="col-sm-6 col-md-3">
<div class="team_member">
{% set photo = profile.photo.first() %}
{% if photo is not empty %}
<img src="{{photo.url}}" alt="{{ profile.personName }}">
{% endif %}
<h5>{{ profile.personName }}</h5>
{% if profile.titlePosition != '' %}
<small> {{ profile.titlePosition }}</small>
{% endif %}
<hr>
<p class="short_bio">{{ profile.shortDescription }}</p>
</div>
</div>
{% endfor %}
</div>
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment