Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Custom loop with data limit

Started by Muut Archive 10 years ago · 1 replies · 402 views
10 years ago

I want a custom loop with data limit, anyone can help me like

{% for p in taxonomy.findTaxonomy({'category':'featured'}) %}
{{ p.title }}
{% endfor %}

Thanks

10 years ago

Something like this should work:

TWIG

{% for p in taxonomy.findTaxonomy({'category':'featured'}) %}
   {% if loop.index <= 5 %}
      {{ p.title }}
   {% endif %}
{% endfor %}

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1362 9 years ago
Archive · by Muut Archive, 9 years ago
2 940 9 years ago
Archive · by Muut Archive, 9 years ago
2 4069 9 years ago
Archive · by Muut Archive, 9 years ago
1 2960 9 years ago
Archive · by Muut Archive, 9 years ago
3 1124 9 years ago