Answers.Body: <p>The <code>relatedTo</code> parameter's <code>targetElement</code> property has to be an ElementCriteriaModel or a single category model:</p>
  
  <pre><code>{% set featured = craft.categories.group('myCatGroup').slug('featured').first() %}
  {% set caseStudies = craft.categories.group('myCatGroup').slug('case-studies') %}
  
  {% set entries = craft.users({
      group: 'resource',
      relatedTo: [
          'and',
          { targetElement: featured },
          { targetElement: caseStudies }
      ]
  }) %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-20T13:30:51.920Z
Answers.Text: Why are we setting .first() for the featured category? This does work though just curious why the .first().
Answers.UserDisplayName: Bowenac
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-20T14:24:19.567Z
Answers.Text: It was just an example for a single category model instead of an ElementCriteriaModel.
Answers.UserDisplayName: carlcs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-20T06:11:01.223Z
Answers.LastActivityDate: 2015-05-20T06:18:07.630Z
Answers.LastEditDate: 2015-05-20T06:18:07.630Z
Answers.UserDisplayName: carlcs
Body: <p>I have searched and tried a few different ways but none have worked so not sure what is wrong.</p>
  
  <p>Example say I have a few categories case studies, featured, articles, videos...</p>
  
  <p>I have tried this way</p>
  
  <pre><code>{% set category = craft.categories.group('resource').relatedTo(
      'and',
      { targetElement: featured },
      { targetElement: case studies }
  ) %}
  {% set entries = craft.entries.relatedTo(category).limit(3).find() %}
  </code></pre>
  
  <p>I have tried this way</p>
  
  <pre><code>{% set category = craft.categories({
      group: 'resource',
      relatedTo: [
          'and',
          { targetElement: featured },
          { targetElement: case-studies }
      ]
  }) %}
  {% set entries = craft.entries.relatedTo(category).limit(3).find() %}
  </code></pre>
  
  <p>I am wanting to find entries that use two categories together example case studies, and featured category.</p>
  
Tags: <templating><categories>
Title: Get entries relatedTo multiple categories
ThreadText: # Get entries relatedTo multiple categories
  
  (Asked by: username_0 on 2015-05-20)
  
  I have searched and tried a few different ways but none have worked so not sure what is wrong.
  
  Example say I have a few categories case studies, featured, articles, videos...
  
  I have tried this way
  
  ```
  {% set category = craft.categories.group('resource').relatedTo(
      'and',
      { targetElement: featured },
      { targetElement: case studies }
  ) %}
  {% set entries = craft.entries.relatedTo(category).limit(3).find() %}
  
  ```
  
  I have tried this way
  
  ```
  {% set category = craft.categories({
      group: 'resource',
      relatedTo: [
          'and',
          { targetElement: featured },
          { targetElement: case-studies }
      ]
  }) %}
  {% set entries = craft.entries.relatedTo(category).limit(3).find() %}
  
  ```
  
  I am wanting to find entries that use two categories together example case studies, and featured category.
  
  **Tags:** templating, categories
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-05-20. Score: 6 | Accepted answer
  
  The `relatedTo` parameter's `targetElement` property has to be an ElementCriteriaModel or a single category model:
  
  ```
  {% set featured = craft.categories.group('myCatGroup').slug('featured').first() %}
  {% set caseStudies = craft.categories.group('myCatGroup').slug('case-studies') %}
  
  {% set entries = craft.users({
      group: 'resource',
      relatedTo: [
          'and',
          { targetElement: featured },
          { targetElement: caseStudies }
      ]
  }) %}
  
  ```
  
  > **Comments:**
  > **username_0**: Why are we setting .first() for the featured category? This does work though just curious why the .first().  
  > **username_1**: It was just an example for a single category model instead of an ElementCriteriaModel.  
  
  ---
  
  