<p>One way to merge two distinct elementCriteriaModels is to perform each query separately grabbing their 'ids', then merge the 'ids', and perform a new query using the 'ids' as the only parameter.</p>

<pre><code>{% set first10 = craft.entries.type('entryTypeHandle').limit(10).ids() %}
{% set all = craft.entries.ids() %}
{% set first10-All = all|without(first10) %} 
{% set entryIds = craft.entries.limit(10).id(first10-All).ids() %}
{% set specialIds = craft.entries.type('entryTypeHandle').offset(10).ids() %}
{% set entryIDs = entryIds|merge(specialIds) %}

{% set entries = craft.entries.id(entryIds) %}
{% paginate entries as entriesOnPage %}
    {% for entry in entriesOnPage %}
        {# entry #}
    {% endfor %}
{% endpaginate %}
</code></pre>

<p>I also notice a few other issues in your example, that might be causing you some problems. </p>

<ul>
<li><p>I see a lot of empty query parameters which are not needed — keep in mind that empty parameters will not really affect the results. (i.e. <code>craft.entries.section().types()</code> is really the same as just <code>craft.entries</code>, which, in this case, will return all entries).</p></li>
<li><p>By modifying an existing query, you are essentially creating two queries to the database, which may not be what you're after.</p>

<pre><code>{% set params = craft.entries.section().types() %}
{% set entries = params.limit(10) %}
</code></pre>

<p>This works, but you are essentially querying the database twice, creating two elementCriteriaModels. A better way to do this is to use a parameters array.</p>

<pre><code>{% set params = {
   section: 'mySectionHandle'
} %}
</code></pre>

<p>If you later need to add more parameters, you can do so using the <code>merge</code> filter, before running the query. The result is that you will only be querying the database once.</p>

<pre><code>{% set params = params|merge({ limit:10 }) %}
{% set entries = craft.entries(params) %}
</code></pre></li>
</ul>

CC BY-SA 3.0
2015-05-09T19:33:35.910Z
Performed it and I got a PHP notice - Array to string conversion.
Dominik Krulak
CC BY-SA 3.0
2015-05-09T19:35:49.717Z
And thank you @Douglas McDonald for issues explanation. I'm aware of that. I actually used the code, that `craft.entries.section().types()` has variables defined. Sorry
Dominik Krulak
CC BY-SA 3.0
2015-05-09T18:42:23.283Z
2015-05-28T10:40:48.677Z
2015-05-28T10:40:48.677Z
Douglas McDonald
<p>I have several entry types, where I want to set a special element criteria for the <code>entryTypeHandleX</code> entry type, and simultaneously loop through all entry types included <code>entryTypeHandleX</code>.</p>

<p>The criteria I want to set is to skip first X entries for <code>entryTypeHandleX</code>. </p>

<p>In my template it looks like this:</p>

<pre><code>{# Set ECM for all sections and entry types #}
{% set params = craft.entries.section().types() %} 

{# Set ECM for all channels and special entry type #}
{% set special = craft.entries.section().type('entryTypeHandleX').offset(X) %} 

{# Set ECM for entries. Check var 'params', Where the data are coming from!!! #}
{% set entries = params.limit(10) %}

{% paginate entries as entriesOnPage %}

{% for entry in entriesOnPage %}
{# entry #}
{% endfor %}

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

<entry><entry-type>
Include single entry type with custom parameters in the for loop within multiple entry types
# Include single entry type with custom parameters in the for loop within multiple entry types

(Asked by: username_0 on 2015-05-09)

I have several entry types, where I want to set a special element criteria for the entryTypeHandleX entry type, and simultaneously loop through all entry types included entryTypeHandleX.
The criteria I want to set is to skip first X entries for entryTypeHandleX. 
In my template it looks like this:
{# Set ECM for all sections and entry types #}
{% set params = craft.entries.section().types() %} 

{# Set ECM for all channels and special entry type #}
{% set special = craft.entries.section().type('entryTypeHandleX').offset(X) %} 

{# Set ECM for entries. Check var 'params', Where the data are coming from!!! #}
{% set entries = params.limit(10) %}

{% paginate entries as entriesOnPage %}

{% for entry in entriesOnPage %}
{# entry #}
{% endfor %}

{% endpaginate %}

**Tags:** entry, entry-type

---

## 1 answers

### Answer by username_1 on 2015-05-09. Score: 3 | Accepted answer

One way to merge two distinct elementCriteriaModels is to perform each query separately grabbing their 'ids', then merge the 'ids', and perform a new query using the 'ids' as the only parameter.
{% set first10 = craft.entries.type('entryTypeHandle').limit(10).ids() %}
{% set all = craft.entries.ids() %}
{% set first10-All = all|without(first10) %} 
{% set entryIds = craft.entries.limit(10).id(first10-All).ids() %}
{% set specialIds = craft.entries.type('entryTypeHandle').offset(10).ids() %}
{% set entryIDs = entryIds|merge(specialIds) %}

{% set entries = craft.entries.id(entryIds) %}
{% paginate entries as entriesOnPage %}
    {% for entry in entriesOnPage %}
        {# entry #}
    {% endfor %}
{% endpaginate %}

I also notice a few other issues in your example, that might be causing you some problems. 

I see a lot of empty query parameters which are not needed — keep in mind that empty parameters will not really affect the results. (i.e. craft.entries.section().types() is really the same as just craft.entries, which, in this case, will return all entries).
By modifying an existing query, you are essentially creating two queries to the database, which may not be what you're after.
{% set params = craft.entries.section().types() %}
{% set entries = params.limit(10) %}

This works, but you are essentially querying the database twice, creating two elementCriteriaModels. A better way to do this is to use a parameters array.
{% set params = {
   section: 'mySectionHandle'
} %}

If you later need to add more parameters, you can do so using the merge filter, before running the query. The result is that you will only be querying the database once.
{% set params = params|merge({ limit:10 }) %}
{% set entries = craft.entries(params) %}

> **Comments:**
> **username_0**: Performed it and I got a PHP notice - Array to string conversion.  
> **username_0**: And thank you @Douglas McDonald for issues explanation. I'm aware of that. I actually used the code, that `craft.entries.section().types()` has variables defined. Sorry  

---

