1

I'm attempting to output a list of entries using slug names. When I do the following, the entries are automatically reordered in alphabetical (title) order. Same thing happens if I target the ID's instead of the slugs.

{% set menu = craft.entries.slug(['home', 'about', 'services', 'news', 'contact']).order(null).find() %}
{% for entry in menu %}
  {{ entry.title }}
{% endfor %}

Is there a way to output the list the same way I put it in?

2

I think you can try .fixedOrder(), but you might have to query by ID and not slug.

.fixedOrder(true)
| improve this answer | |
  • Thanks for the quick responce. Didn't seem to work. No errors; just returns an empty array. – Mark Notton May 5 '17 at 13:55
  • Did you try with the id's craft.entries.id([3, 2, 1]).fixedOrder(true) – AbbeyDesign May 5 '17 at 14:02
  • Using ID's doesn't do any reordering. Basically does nothing. I thought I'd try another variation of the same thing, but no joy there either: craft.entries({'id':[49, 40, 39, 5, 38]}).fixedOrder(true).find() – Mark Notton May 5 '17 at 14:09
  • IDK, I've used it in the past... maybe remove .find() – AbbeyDesign May 5 '17 at 14:14
  • Dammit... I wasn't seeing anything different because it was being cached! My mistake. You are right though, it works now :) Thank you! Interestingly, removing .find() still works too. – Mark Notton May 5 '17 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.