<p>I was presuming that the default Order for Channels and Structure was postDate desc. But it turns out the default for Structure is sortOrder</p>

<pre><code>{% set homepageEntries = craft.entries({
    section: ['channelOne','StructureOne',channelTwo','StructureTwo'],
    order: 'postDate desc',
    limit: 15
}) %}
</code></pre>

<p>Explicitly stating the order seems to fix this issue</p>

CC BY-SA 3.0
2017-08-27T19:45:04.757Z
2017-08-27T19:45:04.757Z
John Henry Donovan
<p>I'm not exactly sure why what you're trying doesn't work, but there seems to be a workable solution in this post: <a href="https://craftcms.stackexchange.com/questions/12522/how-do-i-sort-a-collection-of-entries-from-multiple-sections-by-date">How do I sort a collection of entries from multiple sections by date?</a>.</p>

<p>For your example:</p>

<pre><code>{% set channelOneIds = craft.entries.section('channelOne').ids() %}
{% set structureOneIds = craft.entries.section('structureOne').ids() %}
{% set channelTwoIds = craft.entries.section('channelTwo').ids() %}
{% set structureTwoIds = craft.entries.section('structureTwo').ids() %}

{% set homepageEntryIds = channelOneIds
    |merge(structureOneIds)
    |merge(channelTwoIds)
    |merge(structureTwoIds)
%}

{% set homepageEntries = craft.entries.id(homepageEntryIds).limit(15) %}

{% for item in homepageEntries %}
    {{ item.title }}
{% endfor %}
</code></pre>

<p>The sorting by postDate descending, is the default, but if you want to be explicit, you can add <code>.order('postDate desc')</code> just before the <code>.limit</code> when setting <code>homepageEntries</code>.</p>

CC BY-SA 3.0
2017-08-27T18:56:42.597Z
Thanks Jake. Yes I had tried that one but it doesn't look very efficient where we have 1000s of entries in each section of which there are 6 +.

Im real curious though as to why this doesn't work out of the box as seems like a simple thing that should 'just work'.
John Henry Donovan
CC BY-SA 3.0
2017-08-26T20:27:27.363Z
2017-08-26T20:27:27.363Z
Jake Dohm
<p>If we pass through an array of Channels &amp; Structure sections we find that Channels entries tend to be listed first. So the first 15 will comprise of ChannelOne and ChannelTwo and then start listing the Structure section. </p>

<pre><code>{% set homepageEntries = craft.entries({
    section: ['channelOne','StructureOne',channelTwo','StructureTwo'],
    limit: 15
}) %}

{% for item in homepageEntries %}
{{ item.title }}
{% endfor %}
</code></pre>

<p>All we want is a list of the 15 most recent items from a number of sections.</p>

<p>It does not look to be as straightforward as it seems. Creating multiple arrays of ids and merging still seems to produce the same results. </p>

<templating><sections>
List most recent items combined from Channel and Structure sections
# List most recent items combined from Channel and Structure sections

(Asked by: username_0 on 2017-08-25)

If we pass through an array of Channels & Structure sections we find that Channels entries tend to be listed first. So the first 15 will comprise of ChannelOne and ChannelTwo and then start listing the Structure section. 
{% set homepageEntries = craft.entries({
    section: ['channelOne','StructureOne',channelTwo','StructureTwo'],
    limit: 15
}) %}

{% for item in homepageEntries %}
{{ item.title }}
{% endfor %}

All we want is a list of the 15 most recent items from a number of sections.
It does not look to be as straightforward as it seems. Creating multiple arrays of ids and merging still seems to produce the same results.

**Tags:** templating, sections

---

## 2 answers

### Answer by username_0 on 2017-08-27. Score: 3 | Accepted answer

I was presuming that the default Order for Channels and Structure was postDate desc. But it turns out the default for Structure is sortOrder
{% set homepageEntries = craft.entries({
    section: ['channelOne','StructureOne',channelTwo','StructureTwo'],
    order: 'postDate desc',
    limit: 15
}) %}

Explicitly stating the order seems to fix this issue


---

### Answer by username_1 on 2017-08-26. Score: 2

I'm not exactly sure why what you're trying doesn't work, but there seems to be a workable solution in this post: How do I sort a collection of entries from multiple sections by date?.
For your example:
{% set channelOneIds = craft.entries.section('channelOne').ids() %}
{% set structureOneIds = craft.entries.section('structureOne').ids() %}
{% set channelTwoIds = craft.entries.section('channelTwo').ids() %}
{% set structureTwoIds = craft.entries.section('structureTwo').ids() %}

{% set homepageEntryIds = channelOneIds
    |merge(structureOneIds)
    |merge(channelTwoIds)
    |merge(structureTwoIds)
%}

{% set homepageEntries = craft.entries.id(homepageEntryIds).limit(15) %}

{% for item in homepageEntries %}
    {{ item.title }}
{% endfor %}

The sorting by postDate descending, is the default, but if you want to be explicit, you can add .order('postDate desc') just before the .limit when setting homepageEntries.

> **Comments:**
> **username_0**: Thanks Jake. Yes I had tried that one but it doesn't look very efficient where we have 1000s of entries in each section of which there are 6 +.  Im real curious though as to why this doesn't work out of the box as seems like a simple thing that should 'just work'.  

---

