I’m aware of the relatedTo()
parameter for entries that belong to a category but how can I show entries that are NOT relatedTo()
a certain category?
1 Answer
I found this to work, although maybe there’s a better method.
{% set excludedCategory = craft.categories.id('100') %}
{% set excludedEntries = craft.entries.section('blog').status('live').relatedTo(excludedCategory).ids() %}
{% set entryIds = craft.entries.section('blog').status('live').ids() | without(excludedEntries) %}
{% set entries = craft.entries.section('blog').status('live').id(entryIds) %}