Skip to main content
Adding an if statement semi-solution
Source Link
Adam McCombs
  • 1.7k
  • 12
  • 25

I have an for entry loop in which I need to look for two different field conditions. Separately they are:

craft.entries.eventStartDate('>=' ~ (now.date))

craft.entries.genericEventDate(':notempty:’)

How can I ask craft to look to see if either of these parameters is true?

Update

A work around is to pull the query without these paramaters and then run an if statement like:   

{% if entry.eventStartDate >= now.date or entry.genericEventDate is not empty %}

This works but it's not really ideal since the query is pulling more entries than necessary.

I have an for entry loop in which I need to look for two different field conditions. Separately they are:

craft.entries.eventStartDate('>=' ~ (now.date))

craft.entries.genericEventDate(':notempty:’)

How can I ask craft to look to see if either of these parameters is true?

Update

A work around is to pull the query without these paramaters and then run an if statement like:  {% if entry.eventStartDate >= now.date or entry.genericEventDate is not empty %}

This works but it's not really ideal since the query is pulling more entries than necessary.

I have an for entry loop in which I need to look for two different field conditions. Separately they are:

craft.entries.eventStartDate('>=' ~ (now.date))

craft.entries.genericEventDate(':notempty:’)

How can I ask craft to look to see if either of these parameters is true?

Update

A work around is to pull the query without these paramaters and then run an if statement like: 

{% if entry.eventStartDate >= now.date or entry.genericEventDate is not empty %}

This works but it's not really ideal since the query is pulling more entries than necessary.

added 293 characters in body
Source Link
Adam McCombs
  • 1.7k
  • 12
  • 25

I have an for entry loop in which I need to look for two different field conditions. Separately they are:

craft.entries.eventStartDate('>=' ~ (now.date))

craft.entries.genericEventDate(':notempty:’)

How can I ask craft to look to see if either of these parameters is true?

Update

A work around is to pull the query without these paramaters and then run an if statement like: {% if entry.eventStartDate >= now.date or entry.genericEventDate is not empty %}

This works but it's not really ideal since the query is pulling more entries than necessary.

I have an for entry loop in which I need to look for two different field conditions. Separately they are:

craft.entries.eventStartDate('>=' ~ (now.date))

craft.entries.genericEventDate(':notempty:’)

How can I ask craft to look to see if either of these parameters is true?

I have an for entry loop in which I need to look for two different field conditions. Separately they are:

craft.entries.eventStartDate('>=' ~ (now.date))

craft.entries.genericEventDate(':notempty:’)

How can I ask craft to look to see if either of these parameters is true?

Update

A work around is to pull the query without these paramaters and then run an if statement like: {% if entry.eventStartDate >= now.date or entry.genericEventDate is not empty %}

This works but it's not really ideal since the query is pulling more entries than necessary.

Source Link
Adam McCombs
  • 1.7k
  • 12
  • 25

Multiple craft.entries field parameters

I have an for entry loop in which I need to look for two different field conditions. Separately they are:

craft.entries.eventStartDate('>=' ~ (now.date))

craft.entries.genericEventDate(':notempty:’)

How can I ask craft to look to see if either of these parameters is true?