2

I'm trying to select 1 random entry out of a section based on whether a field has content (schedulerBio). I can get all the entries based on the conditional but can't seem to randomize a single selection. Any help would be appreciated.

{% for entry in craft.entries.section('team').limit(1).find() if entry.schedulerBio|length %}
... stuff
{% endfor }
4

I Think this should work:

{% for entry in craft.entries.section('team').limit(1).order('RAND()').schedulerBio(':notempty:') %}
   ...stuff
{% endfor %}
  • Thanks so much! That worked perfectly. I had not tried notempty. – glider Aug 17 '16 at 1:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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