1

When querying multiple singles by section slugs, is it possible to maintain the order of the results as the query? Currently the return result is sorted by the default postDate desc.

craft.entries.section(['section1', 'section2', 'section3'])

returns an array with the order section1, section2, section3

Documentation doesn't seem to answer this question. https://craftcms.com/docs/templating/craft.entries#order

1

This is only possible with the id parameter in combination with fixedOrder.

{% set entries = craft.entries.id([307, 287, 488]).fixedOrder(true) %}

You can look up your singles' IDs in the URL of the entries in the CP.

example.com/admin/entries/section1/307-section1/

  • Thanks! Worked perfectly! Should have looked at the docs better :) – biko Mar 2 '16 at 2:08

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.