<p>I know an answer has been accepted for this question, but I wanted to provide another example for folks like me who seem to have a thick skull sometimes.</p>

<p>I have a "team" section which is a structure (the entries within this structure do not have their own urls). Within that structure, I have two different entry types. "Team Category" and "Team Member". This allows me to nest different team members under different categories.</p>

<p>For example, </p>

<pre><code>Accounting
    - Bob Smith
Marketing
    - John Doe
</code></pre>

<p>Here is how I did that in my entry template:</p>

<pre><code>{% set teamMembers = craft.entries.section('team').type(['teamCategory', 'teamMember']) %}
    {% for member in teamMembers %}
        &lt;div class="team-member"&gt;
        {% if member.type == 'teamCategory' %}
            &lt;h3&gt;{{ member.title }}&lt;/h3&gt; {# Accounting #}
        {% else %}
            &lt;p&gt;{{ member.title }}&lt;/p&gt;  {# Bob Smith #}
            &lt;/div&gt;
        {% endif %}
    {% endfor %}
</code></pre>

CC BY-SA 3.0
2015-10-23T19:07:43.473Z
2015-10-23T19:07:43.473Z
Damon
<p>You can set the ElementCriteriaModel's <a href="http://buildwithcraft.com/docs/templating/craft.entries#type"><code>type</code></a> parameter to multiple values by passing it an <a href="http://twig.sensiolabs.org/doc/templates.html#expressions">array</a> of entry type slugs:</p>

<pre><code>{% set teachers = craft.entries.section('teacher').type(['teacher', 'demoTeacher']) %}
</code></pre>

<p>Use the <a href="http://buildwithcraft.com/docs/templating/entrymodel#type"><code>type</code></a> property on the entry model to access its entry type in your conditional (also see <a href="http://buildwithcraft.com/docs/templating/entrymodel#properties">this list</a> for other available properties).</p>

<pre><code>{% for teacher in teachers %}

    {{ teacher.title }}

    {% if teacher.type == 'demoTeacher' %}
        ...
    {% endif %}

{% endfor %}
</code></pre>

CC BY-SA 3.0
2014-09-03T22:06:48.633Z
Thanks - that works. Any idea how to use a conditional to test for entry type?
darylknight
CC BY-SA 3.0
2014-09-03T22:08:58.737Z
Sure I have! :)
carlcs
CC BY-SA 3.0
2014-09-03T21:57:57.903Z
2014-09-03T22:13:57.170Z
2014-09-03T22:13:57.170Z
carlcs
<p>I have a 'teacher' channel section on my site. That channel has three entry types, 'teacher', 'demoTeacher' and 'guestTeacher' - how do I display entries from teacher and demoTeach combined? At the moment I'm showing one type like this:</p>

<pre><code>{% for teacher in craft.entries.find({section: 'teacher', type: 'demoTeacher'}) %}
</code></pre>

<p>Secondly, how can I use a conditional that checks for entry type? I need do something like the following (pseudocode):</p>

<pre><code>{% if entrytype is demoTeacher %}
    display read more button
{% endif %}
</code></pre>

<entry-type>
How do I display entries from multiple entry types?
# How do I display entries from multiple entry types?

(Asked by: username_0 on 2014-09-03)

I have a 'teacher' channel section on my site. That channel has three entry types, 'teacher', 'demoTeacher' and 'guestTeacher' - how do I display entries from teacher and demoTeach combined? At the moment I'm showing one type like this:
{% for teacher in craft.entries.find({section: 'teacher', type: 'demoTeacher'}) %}

Secondly, how can I use a conditional that checks for entry type? I need do something like the following (pseudocode):
{% if entrytype is demoTeacher %}
    display read more button
{% endif %}

**Tags:** entry-type

---

## 2 answers

### Answer by username_2 on 2014-09-03. Score: 11 | Accepted answer

You can set the ElementCriteriaModel's type parameter to multiple values by passing it an array of entry type slugs:
{% set teachers = craft.entries.section('teacher').type(['teacher', 'demoTeacher']) %}

Use the type property on the entry model to access its entry type in your conditional (also see this list for other available properties).
{% for teacher in teachers %}

    {{ teacher.title }}

    {% if teacher.type == 'demoTeacher' %}
        ...
    {% endif %}

{% endfor %}

> **Comments:**
> **username_0**: Thanks - that works. Any idea how to use a conditional to test for entry type?  
> **username_2**: Sure I have! :)  

---

### Answer by username_1 on 2015-10-23. Score: 3

I know an answer has been accepted for this question, but I wanted to provide another example for folks like me who seem to have a thick skull sometimes.
I have a "team" section which is a structure (the entries within this structure do not have their own urls). Within that structure, I have two different entry types. "Team Category" and "Team Member". This allows me to nest different team members under different categories.
For example, 
Accounting
    - Bob Smith
Marketing
    - John Doe

Here is how I did that in my entry template:
{% set teamMembers = craft.entries.section('team').type(['teamCategory', 'teamMember']) %}
    {% for member in teamMembers %}
        
        {% if member.type == 'teamCategory' %}
            {{ member.title }} {# Accounting #}
        {% else %}
            {{ member.title }}  {# Bob Smith #}
            
        {% endif %}
    {% endfor %}


---

