<p>You're on the right track with merging arrays of entry IDs. And to keep the sort order with your new <code>craft.entries</code> call there's in fact a method for that: <a href="http://buildwithcraft.com/docs/templating/craft.entries" rel="nofollow"><code>fixedOrder(true)</code></a>.</p>

CC BY-SA 3.0
2015-04-02T15:54:31.050Z
Not sure how I missed that, exactly what I needed. Thanks!
Graham
CC BY-SA 3.0
2015-04-02T06:25:14.813Z
2015-04-02T06:25:14.813Z
carlcs
<p>What I'm trying to accomplish is looping through a collection of entries and have them display (<em>with pagination</em>) in the following order:</p>

<ul>
<li>entries tagged as <strong>Featured</strong> in alphabetical (title) order</li>
<li>entries tagged as <strong>New</strong> in alphabetical (title) order</li>
<li>all remaining entries in alphabetical (title) order</li>
</ul>

<p>The following worked:</p>

<pre><code>craft.entries({ order: 'featuredLightswitchField desc, title asc' })
</code></pre>

<p>However it fails to work if you try to use two lightswitch fields (e.g. featured and new) in addition to the title ordering, and I'd prefer to keep things tag-based instead of needing to add lightswitch fields.</p>

<p>I also attempted at creating a custom array of entry IDs in the proper order and passing it to <code>craft.entries.id()</code>, however I can't find a way of keeping the entries in the order of the array passed to <code>craft.entries.id()</code>.</p>

<pre><code>craft.entries({ id: [3, 1, 2] })
// can't find a way to keep entries in [3, 1, 2] order.
</code></pre>

<p>If there was a way to order the entries based off the <code>id</code> array that would solve the problem, unless there's a better solution.</p>

<p>Can provide additional information if my explanation is insufficient.</p>

<entries><tags><ordering>
Display entries tagged with specific tag(s) before other entries
# Display entries tagged with specific tag(s) before other entries

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

What I'm trying to accomplish is looping through a collection of entries and have them display (with pagination) in the following order:

entries tagged as Featured in alphabetical (title) order
entries tagged as New in alphabetical (title) order
all remaining entries in alphabetical (title) order

The following worked:
craft.entries({ order: 'featuredLightswitchField desc, title asc' })

However it fails to work if you try to use two lightswitch fields (e.g. featured and new) in addition to the title ordering, and I'd prefer to keep things tag-based instead of needing to add lightswitch fields.
I also attempted at creating a custom array of entry IDs in the proper order and passing it to craft.entries.id(), however I can't find a way of keeping the entries in the order of the array passed to craft.entries.id().
craft.entries({ id: [3, 1, 2] })
// can't find a way to keep entries in [3, 1, 2] order.

If there was a way to order the entries based off the id array that would solve the problem, unless there's a better solution.
Can provide additional information if my explanation is insufficient.

**Tags:** entries, tags, ordering

---

## 1 answers

### Answer by username_1 on 2015-04-02. Score: 3 | Accepted answer

You're on the right track with merging arrays of entry IDs. And to keep the sort order with your new `craft.entries` call there's in fact a method for that: [`fixedOrder(true)`](http://buildwithcraft.com/docs/templating/craft.entries).

> **Comments:**
> **username_0**: Not sure how I missed that, exactly what I needed. Thanks!  

---

