Skip Navigation

[Resolved] Showing imgs in relation to checkbox option, all fine, but last No. Problem

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 2 replies, has 2 voices.

Last updated by Waqar 1 year, 6 months ago.

Assisted by: Waqar.

Author
Posts
#2468975

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="hidden link" alt="G-Junioren-U7" />[/types]
[types field="t-altersklassen" option="2" state="checked"]<img style="width: 50px; height: 50px;" src="hidden link" alt="" />[/types]
[types field="t-altersklassen" option="3" state="checked"]<img style="width: 50px; height: 50px;" src="hidden link" alt="" />[/types]
[types field="t-altersklassen" option="4" state="checked"]<img style="width: 50px; height: 50px;" src="hidden link" alt="" />[/types]
[types field="t-altersklassen" option="5" state="checked"]<img style="width: 50px; height: 50px;" src="hidden link" alt="" />[/types]
[types field="t-altersklassen" option="6" state="checked"]<img style="width: 50px; height: 50px;" src="hidden link" alt="" />[/types]
[types field="t-altersklassen" option="7" state="checked"]<img style="width: 50px; height: 50px;" src="hidden link" alt="" />[/types]
[types field="t-altersklassen" option="8" state="checked"]<img style="width: 50px; height: 50px;" src="hidden link" alt="" />[/types]
[types field="t-altersklassen" option="9" state="checked"]<img style="width: 50px; height: 50px;" src="hidden link" alt="" />[/types]
[types field="t-altersklassen" option="10" state="checked"]<img style="width: 50px; height: 50px;" src="hidden link" alt="" />[/types]
[types field="t-altersklassen" option="11" state="checked"]<img style="width: 50px; height: 50px;" src="hidden link" alt="" />[/types]
[types field="t-altersklassen" option="12" state="checked"]<img style="width: 50px; height: 50px;" src="hidden link" alt="" />[/types]
[types field="t-altersklassen" option="13" state="checked"]<img style="width: 50px; height: 50px;" src="hidden link" 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

#2469861

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

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

#2470543

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

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]

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.