I'm currently doing something like this:
{% set vars = "foo, bar" %}
{% set entries1 = craft.entries.section('sectionName').customField1(vars).limit(NULL) %}
{% for entry in entries1 %}
{% if entry not in allEntries %}
{% set allEntries = allEntries | merge([entry]) %}
{% endif %}
{% endfor %}
{% set entries2 = craft.entries.section('sectionName').customField2(vars).limit(NULL) %}
{% for entry in entries2 %}
{% if entry not in allEntries %}
{% set allEntries = allEntries | merge([entry]) %}
{% endif %}
{% endfor %}
But for each custom field I want to check, it's a trip to the database, and I've currently got to check three custom fields. Is there a way to merge these into one trip? I need to know whether the contents of vars
are in either custom field. They might be in one, none of both, for example.