1

I need to pull X entries with

{% set randEntries = craft.entries.section('presenters').order('RAND()').limit(10) %}

But then sort them alphabetically on entry.lastName.

Do I need to Supersort for this, and if so, how do I apply it? Do I need to pull the entries first, and then run the sort?

2

I recon Supersort is they way to go, as its got some really handy functions to make this sort of thing a breeze. Try with the following:

{% set entries = craft.entries.section('presenters').order('RAND()').limit(10) %}
{% set sortedEntries = entries | supersort('sortAs', '{lastName}') %}

{% for item in sortedEntries %}
    {{ item.title }}
{% endfor %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.