Showing (styling) text if condition met

WordPress
24 August, 2021 04:09:54
Crash
Topics: 4
Messages: 6
Hi there, only 24h with the plugin, still finding my feet, I just bought a licence.
I have ACF in checkbox format.
a:9:{i:0;s:6:"option0";i:1;s:5:"option1";i:2;s:6:"option2";i:3;s:6:"option3";i:4;s:6:"option4";i:5;s:7:"option5";i:6;s
:8:"option6";i:7;s:6:"option7";i:8;s:7:"option8";}

I would like to show (style) a text if let's say if Option10 is in the array.

I see I can use the ACTIONS features to achieve this:

action: change CSS colour #000; if condition = option1
or maybe
action: show if condition = option10

The problem is I don't know how to make a condition that accesses the value I need to check.
How can I identify if "option10" is in the array?

Thank you
24 August, 2021 06:29:14
E2Pdf
Support
Topics: 7
Messages: 3176
Hi,

You must be able to use "LIKE" condition instead of "=". It must detect if rendered string will contain value in it (a:9:{i:0;s:6:"option0";i:1;s:5:"option1";i:2;s:6:"option2";i:3;s:6:"option3";i:4;s:6:"option4";i:5;s:7:"option5";i:6;s
:8:"option6";i:7;s:6:"option7";i:8;s:7:"option8";}. ​Screenshot attached.

P.S. Keep in mind please that if you need to show field depending on some value - all fields and elements shown by default, so you can add action with condition to "Hide" it by default via If 1 = 1 and next action can be with condition which will show field depending on some value to have easier logic.

We remain at your service.
We would really appreciate your feedback at WordPress.org!
24 August, 2021 08:03:13
Crash
Topics: 4
Messages: 6
Solved, I was already creating my own shortcodes (...add_shortcode('inm_opciones', 'inm_opcion');...) and dealing with all this coding, like re-inventing the wheel, when you guys have this sorted.

I'll explain here so other clients can use the info:

In the end, I created every option as an HTML object, then add some CSS property if the specific option was not listed (not selected) in the options list (ACF checkbox field).
The configuration look like:
Field value: <div class="mypatio">Patio</div>
Action: Change
Property: CSS
Change: .mypatio{font-style: italic; color: #bbc6c9;}
If: [e2pdf-wp key="opciones" meta="true"]
condition: NOT LIKE
Value: patiox

Bottom line: if the string 'patiox' is not listed in the array coming from the 'option' field I make the object(<div class="patio">Patio</div>) look disabled (pale-grey and italic).

Thank you for your help