I need to pull out all the entries in a channel that are of a certain type of category. But, i also want to be able to then sort the entries by the value of a custom field in that channel.

So right now, i have something like:

{exp:channel:entries channel="my_channel" limit="9" category="{segment_3_category_id}"}

And in that channel, i have a custom field of "price". I want to amend that channel tag to order by my custom field called "price".

How can i achieve this?

  • To clarify for those reading the question, {segment_3_category_id} in the example code is a product of the Low Seg2Cat add-on. Commented Nov 28, 2012 at 13:45

3 Answers 3

{exp:channel:entries channel="my_channel" orderby="price" sort="asc"}

Ordering entries by custom fields comes by default with ExpressionEngine: http://expressionengine.com/user_guide/modules/channel/channel_entries.html#orderby

  • 2
    Also, from the docs... The orderby= and sort= parameters can accept multiple values using the pipe character. This allows you to have multiple levels of ordering and then specify the sort rules for those levels, e.g. orderby="screen_name|date" sort="asc|desc" Commented Nov 22, 2012 at 18:19
  • I have an issue.I have a points table and there are two teams locked at the same point.The one with more goals needs to be on top..any idea how that can be achieved?
    – user2133
    Commented Jun 1, 2014 at 10:38
  • you can pass multiple values to the "ordeby" parameter. So in your case this should do the trick: orderby="points|goals”
    – janvl
    Commented Jun 2, 2014 at 12:40

One addendum to the other answers (though they are perfectly correct) that may be relevant to you given your choice of sorting field:

It's worth noting that if you want your price field ordered data to be ordered numerically in order of increasing/decreasing scale, you will need to change the field content type to decimal (assuming decimal prices). To do this go into your field settings, and you'll find "Field Content" under the "Field Options" section.

Otherwise these values:


will end up sorted alphabetically like so:


when what you want is:


This is very easy to do Just order by your custom field - I do believe you are limited to fieldtype of "text" other fieldtypes won't work with the orderby parameter.


See the docs.

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.