<p>You have a few options here:</p>

<ul>
<li>Use an Entries field (as a Global or as a fields on a Single maybe?) to chose the entries and order them</li>
<li>Make the Entries a Structure section, so you can set the order</li>
<li>use <code>craft.entries({ ids: [3, 1, 2], fixedOrder: true })</code> and query the Entries by ID (if they'll never be deleted and you're cool with hard-coding the order)</li>
<li>create an <code>order</code> field on that entry type to query them by, also with <code>craft.entries()</code></li>
</ul>

<p>It's up to you what the best solution would be, given your set-up, but you have plenty of options.</p>

CC BY-SA 3.0
2018-02-22T14:52:05.287Z
Is there a means of hard-coding order in templates using slug rather than ID? At the moment I have multiple for loops with if conditions, each matching a slug.
David Oliver
CC BY-SA 3.0
2017-06-30T18:12:49.357Z
2017-06-30T18:12:49.357Z
Megan Z.
<p>So I'm trying to loop through some entries and order them by in a specific way. For an example let's say I have the following entires:</p>

<ul>
<li>Example01</li>
<li>Example02</li>
<li>Example03</li>
<li>Example04</li>
</ul>

<p>I now want to loop through these entries and order them in an order such as: Example03, Example01, Example04 and Example2. The order has to be custom where I can change it. </p>

<p>Is this possible and if so how can I achieve this? Thanks</p>

<forloop>
For loop with custom order
# For loop with custom order

(Asked by: username_0 on 2017-06-30)

So I'm trying to loop through some entries and order them by in a specific way. For an example let's say I have the following entires:

* Example01
* Example02
* Example03
* Example04

I now want to loop through these entries and order them in an order such as: Example03, Example01, Example04 and Example2. The order has to be custom where I can change it.

Is this possible and if so how can I achieve this? Thanks

**Tags:** forloop

---

## 1 answers

### Answer by username_1 on 2017-06-30. Score: 2

You have a few options here:

* Use an Entries field (as a Global or as a fields on a Single maybe?) to chose the entries and order them
* Make the Entries a Structure section, so you can set the order
* use `craft.entries({ ids: [3, 1, 2], fixedOrder: true })` and query the Entries by ID (if they'll never be deleted and you're cool with hard-coding the order)
* create an `order` field on that entry type to query them by, also with `craft.entries()`

It's up to you what the best solution would be, given your set-up, but you have plenty of options.

> **Comments:**
> **username_2**: Is there a means of hard-coding order in templates using slug rather than ID? At the moment I have multiple for loops with if conditions, each matching a slug.  

---

