ExpressionEngine 7.5 has been Released! Learn More!
Hi,
I’m having an issue with sorting channel entries by two fields.
My code is the following:
{exp:channel:entries channel="properties" dynamic="no" orderby="title|channel_field" sort="asc"}
When I order by just title or just channel field, it works as intended. But when doing both nothing happens, it just uses the first (before the pipe character).
Any help massively appreciated.
Managed to find the solution to this.
EE doesn’t like if you do title + channel field apparently. I changed the orderby to be “channel_field|channel_field” and its now working as intended.
Did mean that I had to create another field in the backend just called “display_title” but all is now good.
The issue is likely that ExpressionEngine’s orderby doesn’t support multiple fields with the pipe. Try sorting by one field at a time, or if you need multiple sorts, consider using custom logic or a plugin. Alternatively, you could manually combine fields in a custom field for sorting.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.