Hi there,
I have a CPT with a checkbox field (multiple choices available).
On a Ementor Template I display img´s depending of the value (checked or not) of this field.
I have 13 options max to check. and then of course max 13 img´s.
I put it in the template by a Elementor Textbox and it works fine except the last one ( Option 13).
#####
[types field="t-altersklassen" option="1" state="checked"]<img style="width: 50px; height: 50px;" src="lien caché" alt="G-Junioren-U7" />[/types]
[types field="t-altersklassen" option="2" state="checked"]<img style="width: 50px; height: 50px;" src="lien caché" alt="" />[/types]
[types field="t-altersklassen" option="3" state="checked"]<img style="width: 50px; height: 50px;" src="lien caché" alt="" />[/types]
[types field="t-altersklassen" option="4" state="checked"]<img style="width: 50px; height: 50px;" src="lien caché" alt="" />[/types]
[types field="t-altersklassen" option="5" state="checked"]<img style="width: 50px; height: 50px;" src="lien caché" alt="" />[/types]
[types field="t-altersklassen" option="6" state="checked"]<img style="width: 50px; height: 50px;" src="lien caché" alt="" />[/types]
[types field="t-altersklassen" option="7" state="checked"]<img style="width: 50px; height: 50px;" src="lien caché" alt="" />[/types]
[types field="t-altersklassen" option="8" state="checked"]<img style="width: 50px; height: 50px;" src="lien caché" alt="" />[/types]
[types field="t-altersklassen" option="9" state="checked"]<img style="width: 50px; height: 50px;" src="lien caché" alt="" />[/types]
[types field="t-altersklassen" option="10" state="checked"]<img style="width: 50px; height: 50px;" src="lien caché" alt="" />[/types]
[types field="t-altersklassen" option="11" state="checked"]<img style="width: 50px; height: 50px;" src="lien caché" alt="" />[/types]
[types field="t-altersklassen" option="12" state="checked"]<img style="width: 50px; height: 50px;" src="lien caché" alt="" />[/types]
[types field="t-altersklassen" option="13" state="checked"]<img style="width: 50px; height: 50px;" src="lien caché" alt="" />[/types]
#####
Unfortunatly the last one is not displayed and it seems it mixes the values: by checking options No 12 and 13 ist shows img´s of No11 and 12. How does this happen? How to avoid this ?
best regards
Jörg
Hi Jörg,
Thank you for contacting us and I'd be happy to assist.
To troubleshoot this, I'll need to see how this field is set up in the admin area.
Can you please share temporary admin login details, along with the link to the page where the issue can be seen?
Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.
regards,
Waqar
Thank you for sharing these details.
During troubleshooting, I noticed that the code for calling the images based on the checkboxes type custom field, was starting the option value index with '1', whereas it should be started with '0'.
( ref: https://toolset.com/documentation/customizing-sites-using-php/functions/#checkboxes )
I've updated those fields API shortcodes to start from '0' index and all the images are showing now:
[types field="t-altersklassen" option="0" state="checked"]<img .... />[/types]
[types field="t-altersklassen" option="1" state="checked"]<img .... />[/types]
[types field="t-altersklassen" option="2" state="checked"]<img .... />[/types]
[types field="t-altersklassen" option="3" state="checked"]<img .... />[/types]
[types field="t-altersklassen" option="4" state="checked"]<img .... />[/types]
[types field="t-altersklassen" option="5" state="checked"]<img .... />[/types]
[types field="t-altersklassen" option="6" state="checked"]<img .... />[/types]
[types field="t-altersklassen" option="7" state="checked"]<img .... />[/types]
[types field="t-altersklassen" option="8" state="checked"]<img .... />[/types]
[types field="t-altersklassen" option="9" state="checked"]<img .... />[/types]
[types field="t-altersklassen" option="10" state="checked"]<img .... />[/types]
[types field="t-altersklassen" option="11" state="checked"]<img .... />[/types]
[types field="t-altersklassen" option="12" state="checked"]<img .... />[/types]