Skip to content
Grav 2.1 is out: every page speaks Markdown. Read the announcement →

How to I loop through taxonomy using OR instead of AND in Twig?

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

Hi, simple question.

{% for feature in taxonomy.findTaxonomy({'category':['News','Links'] })and.order('date', 'desc').slice(0, 4) %}

The above Twig loops and find articles in my blog tagged with News and Links but I want to find all articles tagged with either News or Links

10 years ago

Actually findTaxonomy takes an optional second param (and | or), defaults to and.

TWIG

{% for feature in taxonomy.findTaxonomy({'category':['News','Links'] }, 'or') %}
---

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 2298 9 years ago
Archive · by Muut Archive, 9 years ago
2 1509 9 years ago
Archive · by Muut Archive, 9 years ago
2 4765 9 years ago
Archive · by Muut Archive, 9 years ago
1 3580 9 years ago
Archive · by Muut Archive, 9 years ago
3 1635 9 years ago