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.

1 Answer 1


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).

  • Not sure how I missed that, exactly what I needed. Thanks!
    – Graham
    Commented Apr 2, 2015 at 15:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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