Skip Navigation

[Résolu] Possible to pass extra data to generic field?

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.

This topic contains 1 réponse, has 2 voix.

Last updated by Luo Yang Il y a 2 années et 1 mois.

Assigned support staff: Luo Yang.

Auteur
Publications
#1373607

I've got a view that populates a generic select field using the usual {"value":"[wpv-post-id]","label":"[wpv-post-title]"} setup.

Is it possible to send extra data to the options- something like {"value":"[wpv-post-id]","label":"[wpv-post-title]","data-slug":"[wpv-post-slug]"}

I ask because I've tried the above and it doesn't seem to work.

Thanks in advance!

#1373651

Luo Yang
Supporter

Languages: Anglais (English ) Chinois simplifié (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Hello,

I assume we are talking about the Toolset Forms shortcode [cred_generic_field], see our document:
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_generic_field
There isn't such kind of feature within above shortcode.

You might consider custom codes, for example in your codes, there is post ID value, so you can use it to get post's slug with PHP codes, for example, this thread:
https://wordpress.stackexchange.com/questions/11426/how-can-i-get-page-slug

More help:
https://codex.wordpress.org/Function_Reference/get_post_field