Showing (styling) text if condition met

WordPress
August 24, 2021 11: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
August 24, 2021 13:29:14
E2Pdf
Topics: 7
Messages: 3614
Support
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!
August 24, 2021 15: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
Get News and Updates
Our monthly newsletter keeps you in the loop, so you'll always be up to date with the latest news and updates about E2Pdf.
* You can update your email subscription preferences here.
All trademarks, service marks, trade names, product names, and logos appearing on this website are the property of their respective owners. The use of trademarks such as Formidable Forms®, Forminator Forms®, Gravity Forms®, JetFormBuilder®, WordPress®, WooCommerce®, WPForms® and others is solely for identification purposes (nominative use) and does not imply any affiliation, sponsorship, or endorsement by the respective trademark holders.
© 2017 - 2026, https://e2pdf.com

We use cookies to collect and analyse information on site performance and usage, to provide social media features and to enhance and customise content and advertisements. By clicking "Accept Selected", you consent to use of selected cookies according to our Cookie Policy.