Answers.Body: <p>I think you can just add <code>.offset(3)</code> to the "remaining" craft.entries query to get the result that you want. Or you could exclude the id's of the first three.</p>
  
  <p>But, this is quite ineffective (performance wise), since you're doing four separate queries to get the entries. An alternative would be to loop over all, and use the <code>loop</code> object together with conditionals to build the output. Something like this:</p>
  
  <pre><code>{% for entry in craft.entries.section('shows') %}
      {% if loop.index==1 %}
          &lt;div class="row"&gt;
              &lt;div class="card-grid card-grid__two-thirds"&gt;
                  {% include "_partials/card" %}
              &lt;/div&gt;
              &lt;div class="card-grid card-grid__one-third"&gt;
                  &lt;h1&gt;AD&lt;/h1&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
      {% elseif loop.index==2 %}
          &lt;div class="row"&gt;
              &lt;div class="card-grid card-grid__two-thirds"&gt;
                  {% include "_partials/card" %}
              &lt;/div&gt;
  
      {% elseif loop.index==3 %}
              &lt;div class="card-grid card-grid__one-half"&gt;
                  {% include "_partials/card" %}
              &lt;/div&gt;
          &lt;/div&gt;
  
      {% elseif loop.index&gt;3 %}
          {% if loop.index==4 %}
               &lt;div class="row grid-remaining"&gt;
          {% endif %}
  
          &lt;div class="card-grid card-grid__one-third"&gt;
                  {% include "_partials/card" %}
          &lt;/div&gt;
  
          {% if loop.index==loop.last %}
              &lt;/div&gt;
          {% endif %}
      {% endif %}
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-08T16:14:31.617Z
Answers.LastActivityDate: 2016-04-08T16:14:31.617Z
Answers.UserDisplayName: André Elvan
Body: <p>I have a layout in Craft with twig that gets the first 3 entries and applies them to the first three containers in the grid.  </p>
  
  <p>I can't figure out how to loop through the remaining entries to add to the <code>grid-remaining</code> div.  With the current code it will repeat entries 1-3 in the grid-remaining div.</p>
  
  <p>Here's what I have at the moment:</p>
  
  <pre><code>{% set firstEntry = craft.entries.section('shows').first() %}
  {% set secondEntry = craft.entries.section('shows').nth(2) %}
  {% set thirdEntry = craft.entries.section('shows').nth(3) %}
  
  {% extends "_layout" %}
  
  {% block content %}
  
      &lt;div class="row"&gt;
          &lt;div class="card-grid card-grid__two-thirds"&gt;
              {% include "_partials/card" with { entry: firstEntry } %}
          &lt;/div&gt;
          &lt;div class="card-grid card-grid__one-third"&gt;
              &lt;h1&gt;AD&lt;/h1&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div class="row"&gt;
          &lt;div class="card-grid card-grid__one-half"&gt;
              {% include "_partials/card" with { entry: secondEntry } %}
          &lt;/div&gt;
          &lt;div class="card-grid card-grid__one-half"&gt;
              {% include "_partials/card" with { entry: thirdEntry } %}
          &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div class="row grid-remaining"&gt;
          {% for entry in craft.entries.section('shows') %}
          &lt;div class="card-grid card-grid__one-third"&gt;
              {% include "_partials/card" %}
          &lt;/div&gt;
          {% endfor %}
      &lt;/div&gt;
  {% endblock %}
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>The following works, but I feel like there must be a cleaner way to achieve the same result.</p>
  
  <pre><code>&lt;div class="row grid-remaining"&gt;
      {% for entry in craft.entries.section('shows') %}
      {% if loop.index != 1 and loop.index != 2 and loop.index != 3 %}
      &lt;div class="card-grid card-grid__one-third"&gt;
          {% include "_partials/card" %}
      &lt;/div&gt;
      {% endif %}
      {% endfor %}
  &lt;/div&gt;
  </code></pre>
  
Tags: <templating><entries>
Title: Loop through remaining craft.entries
ThreadText: # Loop through remaining craft.entries
  
  (Asked by: username_0 on 2016-04-08)
  
  I have a layout in Craft with twig that gets the first 3 entries and applies them to the first three containers in the grid.
  
  I can't figure out how to loop through the remaining entries to add to the `grid-remaining` div. With the current code it will repeat entries 1-3 in the grid-remaining div.
  
  Here's what I have at the moment:
  
  ```
  {% set firstEntry = craft.entries.section('shows').first() %}
  {% set secondEntry = craft.entries.section('shows').nth(2) %}
  {% set thirdEntry = craft.entries.section('shows').nth(3) %}
  
  {% extends "_layout" %}
  
  {% block content %}
  
      <div class="row">
          <div class="card-grid card-grid__two-thirds">
              {% include "_partials/card" with { entry: firstEntry } %}
          </div>
          <div class="card-grid card-grid__one-third">
              <h1>AD</h1>
          </div>
      </div>
  
      <div class="row">
          <div class="card-grid card-grid__one-half">
              {% include "_partials/card" with { entry: secondEntry } %}
          </div>
          <div class="card-grid card-grid__one-half">
              {% include "_partials/card" with { entry: thirdEntry } %}
          </div>
      </div>
  
      <div class="row grid-remaining">
          {% for entry in craft.entries.section('shows') %}
          <div class="card-grid card-grid__one-third">
              {% include "_partials/card" %}
          </div>
          {% endfor %}
      </div>
  {% endblock %}
  
  ```
  
  **EDIT**
  
  The following works, but I feel like there must be a cleaner way to achieve the same result.
  
  ```
  <div class="row grid-remaining">
      {% for entry in craft.entries.section('shows') %}
      {% if loop.index != 1 and loop.index != 2 and loop.index != 3 %}
      <div class="card-grid card-grid__one-third">
          {% include "_partials/card" %}
      </div>
      {% endif %}
      {% endfor %}
  </div>
  
  ```
  
  **Tags:** templating, entries
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-04-08. Score: 2 | Accepted answer
  
  I think you can just add `.offset(3)` to the "remaining" craft.entries query to get the result that you want. Or you could exclude the id's of the first three.
  
  But, this is quite ineffective (performance wise), since you're doing four separate queries to get the entries. An alternative would be to loop over all, and use the `loop` object together with conditionals to build the output. Something like this:
  
  ```
  {% for entry in craft.entries.section('shows') %}
      {% if loop.index==1 %}
          <div class="row">
              <div class="card-grid card-grid__two-thirds">
                  {% include "_partials/card" %}
              </div>
              <div class="card-grid card-grid__one-third">
                  <h1>AD</h1>
              </div>
          </div>
  
      {% elseif loop.index==2 %}
          <div class="row">
              <div class="card-grid card-grid__two-thirds">
                  {% include "_partials/card" %}
              </div>
  
      {% elseif loop.index==3 %}
              <div class="card-grid card-grid__one-half">
                  {% include "_partials/card" %}
              </div>
          </div>
  
      {% elseif loop.index>3 %}
          {% if loop.index==4 %}
               <div class="row grid-remaining">
          {% endif %}
  
          <div class="card-grid card-grid__one-third">
                  {% include "_partials/card" %}
          </div>
  
          {% if loop.index==loop.last %}
              </div>
          {% endif %}
      {% endif %}
  {% endfor %}
  
  ```
  
  
  ---
  
  