<p>What about first getting all the landing page entries, and then use these entries' IDs prefixed with <code>'not'</code> (works with IDs!) in the ID param of a second ElementCriteriaModel.</p>

<pre><code>{% set landingPageIds = craft.entries.section('pages').type('landing').ids() %}    
{% set idParam = 'and, not ' ~ landingPageIds|join(', not ') %}
{% set pagesWithoutLanding = craft.entries.section('pages').id(idParam) %}
</code></pre>

CC BY-SA 3.0
2015-01-27T15:41:42.013Z
... witchcraft!
Douglas McDonald
CC BY-SA 3.0
2015-01-27T15:31:16.343Z
2015-01-27T15:31:16.343Z
carlcs
<p><code>.type("not landing")</code> won't work. If you reread the <a href="https://craftcms.stackexchange.com/questions/4796/is-it-possible-exclude-an-entry-type-from-result-of-craft-entries">post you linked</a> it also states this — I believe it was more of a feature request. You will need to test each entry and either use it directly or merge it into an array for later use.</p>

<pre><code>{% set entries = craft.entries.section("pages") %}
{% for entry in entries if entry.type != "landing" %}
    {{ entry.title }}
{% endfor %}
</code></pre>

<p>or </p>

<pre><code>{% set filteredEntries = [] %}
{% set entries = craft.entries.section("pages") %}
{% for entry in entries if entry.type != "landing" %}
    {% set filteredEntries = filteredEntries|merge(entry) %}
{% endfor %}
</code></pre>

<p>As a side note, if you are using a <code>structure</code> with a hierarchy where landing pages are at the root level and all other entries are children, then you can also use:</p>

<pre><code>{% set entries = craft.entries.section("pages").level('&gt; 1') %}
</code></pre>

CC BY-SA 3.0
2015-01-27T14:57:39.293Z
Ok thanks, seems I was assuming any parameter can be excluded using the not [syntax described in the docs here](http://buildwithcraft.com/docs/templating/elementcriteriamodel#parameter-value-syntax) - have I missed somewhere that lists when you can (e.g. `.id('not 123')`) and can't?

As for my specific example I was already just manually listing the other entry types which achieved the desired results.
Adam Gilleard
CC BY-SA 3.0
2015-01-27T15:05:45.963Z
Good point (and question). According to the docs you linked you would think that it should work. I'm not sure which parameters can use the "not" syntax.
Douglas McDonald
CC BY-SA 4.0
2019-02-16T18:01:14.063Z
For future reference, this (`.type("not landing")`) appears to be working fine in Craft CMS 3.1 _at least_.
Jalen Davenport
CC BY-SA 3.0
2015-01-27T14:47:17.303Z
2015-01-27T14:52:31.940Z
2017-04-13T12:50:59.930Z
Douglas McDonald
<p>I did find <a href="https://craftcms.stackexchange.com/questions/4796/is-it-possible-exclude-an-entry-type-from-result-of-craft-entries">this post</a> while looking to do something similar, but I'm beginning to wonder if there's a bug.</p>

<p>With code along the lines of:</p>

<pre><code>craft.entries.section("pages").type("not landing")
</code></pre>

<p>I'm unexpectedly getting no results. Looking at the logs, it's generating queries that includes:</p>

<pre><code>SELECT * FROM `craft_entrytypes` `t` WHERE `t`.`handle`='not landing'
</code></pre>

<p>I have to think this is at least partly responsible for getting no results. Could anyone point out if I've got the syntax wrong or something?</p>

<entries>
How to exclude entries by type?
# How to exclude entries by type?

(Asked by: username_0 on 2015-01-27)

I did find this post while looking to do something similar, but I'm beginning to wonder if there's a bug.
With code along the lines of:
craft.entries.section("pages").type("not landing")

I'm unexpectedly getting no results. Looking at the logs, it's generating queries that includes:
SELECT * FROM `craft_entrytypes` `t` WHERE `t`.`handle`='not landing'

I have to think this is at least partly responsible for getting no results. Could anyone point out if I've got the syntax wrong or something?

**Tags:** entries


---

## 2 answers

### Answer by username_2 on 2015-01-27. Score: 5 | Accepted answer

.type("not landing") won't work. If you reread the post you linked it also states this — I believe it was more of a feature request. You will need to test each entry and either use it directly or merge it into an array for later use.
{% set entries = craft.entries.section("pages") %}
{% for entry in entries if entry.type != "landing" %}
    {{ entry.title }}
{% endfor %}

or 
{% set filteredEntries = [] %}
{% set entries = craft.entries.section("pages") %}
{% for entry in entries if entry.type != "landing" %}
    {% set filteredEntries = filteredEntries|merge(entry) %}
{% endfor %}

As a side note, if you are using a structure with a hierarchy where landing pages are at the root level and all other entries are children, then you can also use:
{% set entries = craft.entries.section("pages").level('> 1') %}

> **Comments:**
> **username_0**: Ok thanks, seems I was assuming any parameter can be excluded using the not [syntax described in the docs here](http://buildwithcraft.com/docs/templating/elementcriteriamodel#parameter-value-syntax) - have I missed somewhere that lists when you can (e.g. `.id('not 123')`) and can't?  As for my specific example I was already just manually listing the other entry types which achieved the desired results.  
> **username_2**: Good point (and question). According to the docs you linked you would think that it should work. I'm not sure which parameters can use the "not" syntax.  
> **username_3**: For future reference, this (`.type("not landing")`) appears to be working fine in Craft CMS 3.1 _at least_.  

---

### Answer by username_1 on 2015-01-27. Score: 4

What about first getting all the landing page entries, and then use these entries' IDs prefixed with 'not' (works with IDs!) in the ID param of a second ElementCriteriaModel.
{% set landingPageIds = craft.entries.section('pages').type('landing').ids() %}    
{% set idParam = 'and, not ' ~ landingPageIds|join(', not ') %}
{% set pagesWithoutLanding = craft.entries.section('pages').id(idParam) %}

> **Comments:**
> **username_2**: ... witchcraft!  

---

