Passer la navigation

[Résolu] Echo [title] from [value] option select field

This support ticket is created Il y a 1 year, 7 months. There's a good chance that you are reading advice that it now obsolete.

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Fuseau horaire du supporter : Asia/Kolkata (GMT+05:30)

Ce sujet contient 1 reply, a 1 voix.

Dernière mise à jour par quentinN Il y a 1 year, 6 months.

Assisté par: Minesh.

Auteur
Publications
#2783738
Capture d’écran 2024-11-14 à 15.51.14.png

Hello,
I would like to display the Title of an option in a select field rather than its value, which is just a slug.
How can I do this?
Best regards,
Quentin NORMAND

#2783933

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

What if you try to use the Types PHP API function types_render_field() in order to display the select box selected option text.
- https://toolset.com/documentation/customizing-sites-using-php/functions/#select

For example:

$selected_option_text = types_render_field("type-viager", array());
echo $selected_option_text;
#2783979

It's work, thanks!