Questions tagged [sorting]
The sorting tag has no usage guidance.
12
questions
15
votes
1
answer
1k
views
How do you sort elements queried from multiple channels?
This is how I query elements from multiple channels:
{% set allEntries = craft.entries.section(['publication','text', 'exhibition']).limit(null) %}
I now want to sort all these entries by a custom ...
7
votes
1
answer
2k
views
Sorting entries A-Z, ignoring 'The' and grouping by first letter
Probably going to be an easy win for someone here, but being able to do this is currently eluding me. So:
I'm trying to output a list of Artist names grouped by first letter but need to ignore 'The ' ...
3
votes
1
answer
1k
views
How do I sort a collection of entries from multiple sections by date?
I want to create a featured story slider on my website and gather the latest entries from multiple channels to populate it.
Here is what is working:
# fetch the entries
{% set featuredBlog = craft....
12
votes
1
answer
8k
views
How do I sort entries by two variables?
Currently I am sorting the entries by an ID:
{% for gallery in craft.entries.section('Gallery').order('available desc').limit(none) %}
but I would like to show the latest entries on top, currently ...
8
votes
2
answers
18k
views
Sort merged array by array value in Twig?
I have two Instagram API responses that I want to merge, by the photo's created_time. Is there a way to do that in Twig?
Right now I am just using this
{% set instagram = <data> %}
{% set ...
7
votes
1
answer
1k
views
In Craft 2.5, how can you sort the entry index page by a custom field?
I recently updated a very large site to Craft 2.5. One of the great new features is the ability to view custom fields as columns on the entry index page.
Previously, I used the DashCols plugin to ...
5
votes
1
answer
535
views
Modifying search scoring algorithm
Is there any way to tweak the way search score is calculated? For example, I would like words in the title field to be scored higher than the same terms in other fields.
4
votes
2
answers
877
views
Sorting an array of entries according to a fixed list/array of items
I want to sort an array of entries in a specific order. Every entry has a 'shoptype' and I want to show all entries for type A, than type B, than type C.
A partial solution would be to iterate over ...
3
votes
1
answer
281
views
Using Supersort with date field
I'm fetching entries from several different locales and merging them together into a single object.
I then want to sort these to be most recent entry shown first.
Using Supersort and the custom ...
2
votes
4
answers
2k
views
Custom order related entries
is it possible to replicate the order of related entries in the front end as they appear in the admin entries panel? (see images below)
Right now, in the front end it only sorts the order in which ...
1
vote
1
answer
279
views
Sorting across blocks (to get prev/next links)
issue is an entry that has a matrix field named contents, whose blocks have an entries field named works, and the related works channel has an entries field named authorPeople.
Issue 1's contents ...
1
vote
1
answer
1k
views
Sort entries in a category via entry field
I have a section for Businesses. I also have categories that these businesses can belong to. On each category page I want to list all the businesses that belong to that category. So far so good, but ...