SuperSort

SuperSort provides a powerful Twig filter for ordering an array of values — either using one of PHP's built-in methods to sort the actual values, or using custom "sort as" methods to arrange the array based on the rendered results of running each member through a Twig object template.

Using SuperSort's "sort as" methods, you can sort an array of elements by any accessible object value — including values from Matrix blocks, attributes of related elements, math calculations, etc.

{% upcomingEvents | supersort('sortAs', '{eventDates.first.date}') %}

 

Download + Docs

→ Get SuperSort