<p>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:</p>

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

{% for item in sortedEntries %}
    {{ item.title }}
{% endfor %}
</code></pre>

CC BY-SA 3.0
2017-02-12T04:38:55.320Z
2017-02-12T04:38:55.320Z
crawf
<p>I need to pull X entries with</p>

<pre><code>{% set randEntries = craft.entries.section('presenters').order('RAND()').limit(10) %}
</code></pre>

<p>But then sort them alphabetically on entry.lastName.</p>

<p>Do I need to <a href="https://github.com/TopShelfCraft/SuperSort" rel="nofollow noreferrer">Supersort</a> for this, and if so, how do I apply it? Do I need to pull the entries first, and then run the sort?</p>

<entries><random><plugin-supersort><sort>
Retrieve entries by random sort, then resort alphabetically
# Retrieve entries by random sort, then resort alphabetically

(Asked by: username_0 on 2017-02-11)

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?

**Tags:** entries, random, plugin-supersort, sort


---

## 1 answers

### Answer by username_1 on 2017-02-12. Score: 2 | Accepted answer

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 %}


---

