<p>OK resolved now - client slug mis-spelling! thx</p>

CC BY-SA 4.0
2019-06-27T11:16:27.380Z
2019-06-27T11:16:27.380Z
joomkit
<p>I have two categories, Annual Reviews and Publications.
I want to get all entries from these and paginate them.</p>

<p>The code I am using is fine for one category - both work individually, but as soon as the criteria contains two categories i get zero results no errors. I have tried using 'one()' on the initial categories as I only want category returned. 
What am I missing? (using Craft Pro 3.1.31)</p>

<pre><code>{% set publications = craft.categories.group('resources').slug('publications') %}
{% set annualreviews = craft.categories.group('resources').slug('annualreviews') %}

{% set entries = craft.entries({
section: 'resources',
relatedTo: [
'and',
{ targetElement: publications },
{ targetElement: annualreviews }
]
}).limit('10').orderBy('title') %}

{% paginate entries as pageInfo, pageEntries %}
</code></pre>

CC BY-SA 4.0
2019-06-25T22:11:07.493Z
Are you sure you're wanting `'and'`? Or are you meaning "get all entries that have a `publications` _or_ `annualreviews` category?
Brad Bell
CC BY-SA 4.0
2019-06-27T11:15:42.117Z
OK resolved now - client slug mis-spelling! thx
joomkit
<categories><relations><relatedto>
Getting entries from multiple categories
# Getting entries from multiple categories

(Asked by: username_0 on 2019-06-25)

I have two categories, Annual Reviews and Publications.
I want to get all entries from these and paginate them.
The code I am using is fine for one category - both work individually, but as soon as the criteria contains two categories i get zero results no errors. I have tried using 'one()' on the initial categories as I only want category returned. 
What am I missing? (using Craft Pro 3.1.31)
{% set publications = craft.categories.group('resources').slug('publications') %}
{% set annualreviews = craft.categories.group('resources').slug('annualreviews') %}

{% set entries = craft.entries({
section: 'resources',
relatedTo: [
'and',
{ targetElement: publications },
{ targetElement: annualreviews }
]
}).limit('10').orderBy('title') %}

{% paginate entries as pageInfo, pageEntries %}

**Tags:** categories, relations, relatedto
> **Comments:**
> **username_1**: Are you sure you're wanting `'and'`? Or are you meaning "get all entries that have a `publications` _or_ `annualreviews` category?  
> **username_0**: OK resolved now - client slug mis-spelling! thx  

---

## 1 answers

### Answer by username_0 on 2019-06-27. Score: 1

OK resolved now - client slug mis-spelling! thx


---

