I have a page that displays musicians grouped by their musical instrument. I am outputting them grouped by instrument, but I have been asked to sort the instrument groups by a custom order specified by the client. Not alphabetical, but a specified order. How should I handle this? I was using .orderBy(‘instrument asc’) in the query to get them in alphabetical order. Would I be creating an array and then assigning keys to them for the order I want and then order by the numerical keys or something? I haven’t been able to figure it out yet. Code snippet below:
{% set relatedMusicians=craft.entries.section('bios’)
.relatedTo(entry)
.orderBy('instrument asc')
.with(['bioPhoto'])
.all()
%}