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.