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 %} 

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') %}


{% 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)

1 Answer 1


Pretty straight forward in the end =]

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.