Need help with dynamic image grid I am trying to make my image grid form out dynamically. I got it kinda working, But I need to figure out how to make my grid rows dynamic. I am kinda forcing it to start a new row at every 4th item right now, but dossent feel like the right way to do it.

This is my code:

    &lt;div class="widewrapper weak-highlight"&gt; &lt;!-- knappebilde start --&gt;

    &lt;div class="container content col-lg-12"&gt;
        &lt;div class="row"&gt;
 {% for entry in craft.entries.section('knapperForside').limit(50).find() %}        
            &lt;div class="showroom-item col-md-3"&gt;
                &lt;div class="image"&gt;
                    {{ entry.bilde }}
                    &lt;!-- overlay start --&gt;
                    &lt;a class="overlay" href="{{ entry.knappUrl }}"&gt;
                         &lt;i class="glyphicons search"&gt;&lt;/i&gt;
                         &lt;div class="name"&gt;{{ entry.title }}&lt;/div&gt;
                    &lt;/a&gt;
                    &lt;!-- overlay stop --&gt;
                &lt;/div&gt;  &lt;!-- Image Stop --&gt;
                &lt;a href="{{ entry.title }}"&gt;&lt;h4&gt;{{ entry.title }}&lt;/h4&gt;&lt;/a&gt;
            &lt;/div&gt;
  {% endfor %}           
         &lt;/div&gt;      &lt;!--  row stop  --&gt;
    &lt;/div&gt;          &lt;!-- Container Stop --&gt;        

        &lt;div class="clearfix"&gt;&lt;/div&gt;
&lt;/div&gt;     &lt;!-- knappebilde stop --&gt;
To add a row at every 4th item, you can use twig's batch filter:

Twig Batch

Alternatively(a little more hacky) you can do {% if loop.index is divisible by(4) %} stuff {% endif %}. But batch is probably better.