Skip to content
Loop stuff.
Branch: master
Clone or download
Pull request Compare This branch is 5 commits ahead, 7 commits behind pixelfear:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


For Statamic V2.x

Loop stuff.

Loop over something n times or between a range.


Drop Loop folder in your site/addons


  • from: Where to begin the loop. Defaults to 1.
  • times: Number of times to loop.
  • to: Where to end the loop.

Use either times or to. Do not use both.


  • value: The current value of the loop.
  • index: The number of the iteration.
  • zero_index: The zero-based index.


Count to 10.

{{ loop times="10" }}
  {{ value }}
{{ /loop }}

Number based pagination.

{{ entries:listing folder="calendar" limit="10" }}
    <li>{{ title }}</li>
{{ /entries:listing }}

{{ entries:pagination folder="calendar" limit="10" }}
    {{ loop times="{ total_pages }" }}
        {{ if index == current_page }}
            {{ index }}
        {{ else }}
            <a href="{{ url }}?page={{ index }}">{{ index }}</a>
        {{ endif }}
    {{ /loop }}
{{ /entries:pagination }}

Year selection

<select name="year">
{{ loop from="1995" to="2015" }}
  <option value="{{ value }}">{{ value }}</option>
{{ /loop }}

Automatically reverse the order when from is larger than to

<select name="year">
{{ loop from="2016" to="2010" }}
  <option value="{{ value }}">{{ value }}</option>
{{ /loop }}
You can’t perform that action at this time.