I want to display 10 entries, only if they pass a conditional. Right now the channel tag will count all entries first, so I end up with less than 10 entries displaying (as some of those 10 don't meet the 'if').

{exp:channel:entries channel="tours" limit="10" sort="asc" orderby="departure_date"}
    {if departure_date > current_time}
         [TEN THINGS HERE]

I can’t use {entry_date} as my ‘departure_date’ - it has to be a custom field.

I tried an embed - but that’s not working for me...


3 Answers 3


Can't the numeric matching of the search parameter help you?

{exp:channel:entries channel="tours" search:departure_date=">{current_time}" limit="10" sort="asc" orderby="departure_date"}
  • Well I'll be damned.
    – jrothafer
    Oct 11, 2015 at 19:55
  • Yep - that's what i'm talking about. That worked, and I learned something. Thanks Robson.
    – daver
    Oct 12, 2015 at 4:48

Writing your own query would probably be the most efficient way and would let you pull out exactly what you want.



I would use a PHP script to get around these kind of hassles. You can use the query module to do some manual selects on the database, if you really need to avoid PHP script in your template.


The ExpressionEngine template parsing engine doesn't provide any means to break out of a {exp:channel:entries} loop based on a conditional.

You basically need to break out of your {exp:channel:entries} loop once you hit ten entries that satisfy your conditional. There's no viable way to do that, even with an absurd PHP-enabled template, regardless of if it's set to parse PHP at input or output. Templating like this only affords forward progression execution.

I can help you generate a PHP script, or a query module tag, to do what you want... but you'll need to expand your question to include what your field IDs are, if you're using MSM, and other issues. Hope I'm being helpful.


Official edit: If any of the heavy-hitters on this forum know of a way to break out of a EE tag loop (like {exp:channel:entries}), please chime in. I might be an idiot.

Your Answer

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

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