I'm trying to return results based on a year stored in a custom field. For example, returning entries with a model year greater than 2006 and less than 2009. Is there a search syntax to support this?

For example: for entry in craft.entries.section('equipment').search(modelYear: > 2006 && < 2009) …

1 Answer 1


You can do a certain amount of logic in the ElementCriteriaModel syntax. I think this will work:

{% set entries = craft.entries.section('equipment').modelYear('and, > 2006, < 2009') %}
{% for entry in entries %}
{% endfor %}

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.