Hi there,
I want to use a Plugin for Dynamic Conditions,... which gives me the results I need so far, even in combination with toolset.
In a CPT I have a field for Checkboxes enabeling the editor to check more than one Checkbox.
In general I easely can show an image in condition to any field of my CPT field except one... how can I use a Checkbox field to show me an image depending on the value of Checkbox?
strangly this field is not available in Elementor or the dynamic conditions plugin,...
Or alternativly I am thinking of building a view, just showing images on separate conditions related to the checked boxes of the CPT. but how to trigger that in a view?
Jörg
The row with the 7 Icons U7 to U12 ( in my screenshot), I want to show or hide depending on the Checked Boxes of my CPT Field
Iam talking about a single Post of my CPT.
Hello,
I assume we are talking about a custom checkboxes field created with Types plugin.
If it is, you can display different image/text by checkboxes field values, for example:
[types field="my-checkboxes" option="0" state="checked"]image of option 1[/types]
[types field="my-checkboxes" option="1" state="checked"]image of option 2[/types]
[types field="my-checkboxes" option="2" state="checked"]image of option 3[/types]
...
More help:
https://toolset.com/documentation/customizing-sites-using-php/functions/#checkboxes
Hi there again
Thx for your reply and recommendations.
I guess I understand what to do now. But I am a bit confused where to put the customized code. In a view, in the Loop editor?
Or ist just for a html-widget in Elementor?
Jörg
Those are just WordPress shortcodes, you can put it into anywhere supports shortcodes, for example: post content, text/html widgets.
Hi there again
and thx for your reply again.
Are you sure about the braces? thought WP shortcode have a [] braces.
Anyway,... can`t bring this to work:
{{types field="altersklassen" option="E-Junioren U10" state="checked"}}<img src="versteckter Link alt="E-Junioren U10">[/types}}
"altersklassen is the slug of the field and "E-Junioren U10" is the Value.
Any Idea what my mistake is?
best regards
Jörg
Dear Jörg,
Yes, you are right, there is a mistake in the codes I mentioned above, there should not be "[".
The attribute "option" support numeric value: 0, 1, 2...
See our document:
https://toolset.com/documentation/customizing-sites-using-php/functions/#checkboxes
option:
"zero-based index number"
e.g. option=”0″ Will output the value for the option number specified. For checkboxes, will display the checked valued of the nth checkbox in the group.
For example, you are going to check the first option of the custom checkboxes field, so the attribute "option" value should be 0, you can try to modify the code you mentioned above as below:
{!{types field="altersklassen" option="0" state="checked"}!}<img src="<em><u>versteckter Link</u></em> alt=" e-junioren="" u10"="">{!{/types}!}
And test again.
Here is update from our 2nd tier supporters, we recommend to use [] shortcode wrapper unless GUI generates {!{, so the example should be these:
[types field="altersklassen" option="0" state="checked"]<img src="<em><u>versteckter Link</u></em> alt=" e-junioren="" u10"="">[/types]
Here is the details from our 2nd tier supporers:
You should use [ ].
Only if the GUI generates {!{ then you have to use that syntax.
This is a syntax made for “compatibility”, to avoid certain themes executing Toolset shortcodes before they are rendered.
So we implemented the {!{ syntax to avoid Themes executing those shortcodes before we want, giving Toolset the control when to execute its own shorcodes
Hi there again,...
Thx for your replay ,... and we are very close now.
This one here works:
[types field="altersklassen" option="4" state="checked"]<img src="versteckter Link" alt="" style="width:45px;height:45px;">[/types]
But how to list another shortcode?
If I add another in the next line the 2nd image does not work i.e.
[types field="altersklassen" option="4" state="checked"]<img src="versteckter Link" alt="" style="width:45px;height:45px;">[/types]
[types field="altersklassen" option="5" state="checked"]<img src="versteckter Link" alt="" style="width:45px;height:45px;">[/types]
Do I have to have a widget or each , or how to list it? With a Comma?
Jörg
Hi there,
It works now!!!
There was another issue on the checked boxes.
But last question: How to show a different image for all checkboxes unchecked? What is the right spelling prior to the image path?
Jörg
You can use [wpv-conditional] shortcode to check if all checkboxes unchecked, for example:
[wpv-conditional if="( $(wpcf-altersklassen) eq '' )"]
Another image here ...
[/wpv-conditional]
More help:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/checking-fields-and-other-elements-for-emptynon-empty-values/
Hi there last time
Thx for your 1st Class support, everything works as needed.
Thank you very much and
best regards from Germany
Jörg
My issue is resolved now. Thank you!