ACF array in conditions

  • WordPress version: 6
  • Cwicly Plugin version: 1.1.5.3
  • Cwicly Theme version: 1.0.3

I built a table for this page: https://www.ombres-et-lumieres.eu/vente-photos/la-placa-de-la-merce-un-condense-de-latmosphere-de-xativa/

But, I have to put some conditions to be sure that the part of the table where there is no data is not displayed. But, when I enter the condition, it leads to an error: the test is done on an ACF array (checkbox) and a field is missing: which array 's field do I have to test?

I watched a serie of tutos here: Wordpress FSE - Création des champs ACF avec Cwicly
From #5 to #8, the conditions with ACF fields are explained (in french) and very clearly.
I hope that will help you.

1 Like

I saw that video a few weeks ago, but he uses a “true/false” system that is not my case and my needs, for this post: There are several ways of printing a photo, until now I just use two, that is why I use a checkbox list that gives an array. So I have to control the values in the array.
I could use a “true/false” field, but the back end will be heavier.

In another situation, see, for example, the homepage, I use a condition on each “div” with photo as background: I test if they are vertical or horizontal with an ACF radio field.

ok!
It could be a request to add an option in “Show/Hide Conditions > Condition” for a custom condition that could be written in a snippet. This feature already exists in Oxygen or in the plugin “If menu”.
With a few lines of PHP, it becomes possible to test everything including the values extracted from array.

In fact, I have more or less the same problem.
The display of posts in an archive is based on a date that is calculated: published date + duration defined once for all the site.
I can’t find another solution but custom condition (with reading of the fixed value and calculation of the new date in PHP) to fix this problem.

Hi @Ombres-et-lumieres,

Are you still experiencing trouble with this?

The last few updates should have addressed this.

I don’t know.

I solved that by using a field with a value and I tested that value.