1

Is there a way to sort Channel Entries by a Matrix field?

How would this work if date was a Matrix field?

{exp:channel:entries orderby="date" sort="desc" limit="10"}
        <a href="{title_permalink='channel/comments'}">{title}</a><br>
{/exp:channel:entries}
3
  • 1
    Do you mean ordering the entries in a channel loop by a date field within a matrix field within that channel? Likely a query will be the answer - what you have above won't do it for sure - the matrix field parses WITHIN your channel entries loop so it can't be used as a parameter. Apr 4, 2013 at 15:13
  • Ah I see. Now that I know that a matrix field cannot be used as an orderby parameter, I will explore other options. Can you clarify what you mean by "query". Do you mean using EE's SQL module or custom SQL? Thanks.
    – sifxtreme
    Apr 4, 2013 at 16:56
  • I meant the query module yes (or you could enable PHP in the template and use custom queries). Queries are not my strength, however. I'm aware of when they're likely to come into play, but I haven't quite gotten the knack of writing them myself yet. Apr 4, 2013 at 20:31

1 Answer 1

1

I heard back from ExpressionEngine support about this question - There is actually no way to do it from the entries tag. As Jean St-Amand said in the comments, you would need to have a custom query.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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