Looping Through Grids In the Variables Module
Created 6 years ago by carsonsuite

I created and added a Grid into my variables module group, but could not figure out how to loop through it. Most may already know this, but hope this helps others save time if looking through the forum 😄

http://go.web901.io/GG33Zk

ryanthompson  —  6 years ago

Try something like this:

{% for grid in variable('example', 'grid_field') %}
    {{ grid.type }} // The grid stream slug
    {{ grid.some_field }} // Maps automatically to the grid entry
{% endfor %}

Check it out: https://pyrocms.com/documentation/grid-field-type/latest#usage/basic-output