Hot answers tagged

1

I would like to thank Michael Rog for supplying an answer at this similar question about SuperSort: Sorting an array of entries according to a fixed list/array of items The code that lets me sort by instrument in any order I want: {% set relatedMusicians = craft.entries.section('bios').relatedTo(entry) .with(['bioPhoto']) .all() %} {% set ...


1

Yeh there's few workarounds. Your entries field is close to what Nathanial from P&T mentioned on the issue tracker: If you create a global set and add a custom product field. Then select all the products. This gives you the ability to drag and drop the order of the products. You can use this in conjunction with the on save event and catch the save of ...


1

I know this is answered but I just wanted to suggest a potentially better way. I would suggest trying the Preparse field plugin. This way you can create a new field that automatically generates the data you want to sort/query (in your case, the first session date). This will only happen when you save the entry so it will likely speed up your API considerably....


1

I don't know if I ever got this working exactly as I initially intended, but this is the final transformer code I ended up going with. Basically the same but with some usort calls on sessions and dates. I then had to manually do the pagination in the Twig template where courses were listed. Hope it helps! <?php namespace Craft; require craft()->...


1

As of SuperSort 3.1.0, you can use the customOrderSort and customOrderSortAs methods to accomplish this: {% set shops = craft.entries.section('shops')... %} {% set customOrderList = [ 'SomeShopType', 'AnotherShopType', 'OneMoreShopType' ] %} {% set sortedShops = shops | supersort('customOrderSortAs', as='{shopType}', comp=customOrderList) %}...


Only top voted, non community-wiki answers of a minimum length are eligible