<p>Pretty straight forward in the end =]</p>

<pre><code>{% set allPeople = craft.entries.section('People') %}     
{% for entry in allPeople if entry.peopleCategory.contains('leadership') %}
</code></pre>

CC BY-SA 3.0
2017-10-15T05:39:09.000Z
2017-10-16T19:50:01.563Z
2017-10-16T19:50:01.563Z
Jon Yetter
<p>I’ve got a <code>people</code> entry type that has a <code>peopleCategory</code> multiselect field. I’m wanting to loop through all the people and grab the ones that have a a specific item selected in the multiselect field (in this case - that they have been marked as being in 'leadership'). I was using   </p>

<pre><code>{% for entry in craft.entries.section(‘People’).peopleCategory(‘leadership’) %}
    {% if entry.peopleCategory.contains('leadership') %}
</code></pre>

<p>but in conjunction with another if statement</p>

<pre><code>{% if loop.index==1 %}
{% elseif loop.index==2 %} 
{% elseif loop.index==3 %} 
etc
</code></pre>

<p>and that ended up throwing off the formatting in the template  - so now I’m tyring to find a new solution using something like: </p>

<pre><code>{% set leadershipTeamTest = allPeople.peopleCategory('leadership').peopleCategory('leadership') %}
</code></pre>

<p>or</p>

<pre><code>{% set allPeople = craft.entries.section('People') %}
{% set leadershipTeam = allPeople.peopleCategory('leadership').peopleCategory.contains('leadership') %}
</code></pre>

<p>but having trouble where it’s either returning everyone, or no one. </p>

<p>I'm still a pretty new to Craft - but would appreciate any help ( was using this - <a href="https://craftcms.com/docs/multi-select-fields" rel="nofollow noreferrer">https://craftcms.com/docs/multi-select-fields</a> but couldnt get it going)</p>

<forloop>
Looping through Entries based on MultiSelect Field Selection
# Looping through Entries based on MultiSelect Field Selection

(Asked by: username_0 on 2017-10-15)

I’ve got a people entry type that has a peopleCategory multiselect field. I’m wanting to loop through all the people and grab the ones that have a a specific item selected in the multiselect field (in this case - that they have been marked as being in 'leadership'). I was using   
{% for entry in craft.entries.section(‘People’).peopleCategory(‘leadership’) %}
    {% if entry.peopleCategory.contains('leadership') %}

but in conjunction with another if statement
{% if loop.index==1 %}
{% elseif loop.index==2 %} 
{% elseif loop.index==3 %} 
etc

and that ended up throwing off the formatting in the template  - so now I’m tyring to find a new solution using something like: 
{% set leadershipTeamTest = allPeople.peopleCategory('leadership').peopleCategory('leadership') %}

or
{% set allPeople = craft.entries.section('People') %}
{% set leadershipTeam = allPeople.peopleCategory('leadership').peopleCategory.contains('leadership') %}

but having trouble where it’s either returning everyone, or no one. 
I'm still a pretty new to Craft - but would appreciate any help ( was using this - https://craftcms.com/docs/multi-select-fields but couldnt get it going)

**Tags:** forloop

---

## 1 answers

### Answer by username_0 on 2017-10-15. Score: 1 | Accepted answer

Pretty straight forward in the end =]
{% set allPeople = craft.entries.section('People') %}     
{% for entry in allPeople if entry.peopleCategory.contains('leadership') %}


---

