I have a taxonomy called Format. In this taxonomy I want to show the input field based on value of taxonomy.
If Text -- show image link
If audio - show audio link
If Vidoe -- show video link.
I am using code but it does not seem to work -
<div class="form-group">
<label for="%%FORM_ID%%_format">[cred_i18n name='format-label']Select Resource Format[/cred_i18n]</label>
[cred_field field='format' force_type='taxonomy' output='bootstrap' display='select' single_select='true']
</div>
[cred_show_group if="( $(format) eq 'Text' )" mode="None"]
<div class="form-group">
<label for="%%FORM_ID%%__featured_image">[cred_i18n name='_featured_image-label']Add Featured Image[/cred_i18n]</label>
[cred_field field='_featured_image' output='bootstrap' previewsize='thumbnail']
</div>
[/cred_show_group]
[cred_show_group if="( $(format) eq 'Audio' )" mode="None"]
<div class="form-group">
<label for="%%FORM_ID%%_audio-link">[cred_i18n name='audio-link-label']Audio Link[/cred_i18n]</label>
[cred_field field='audio-link' force_type='field' class='form-control' output='bootstrap']
</div>
[/cred_show_group]
[cred_show_group if="( $(format) eq 'Video' )" mode="None"]
<div class="form-group">
<label for="%%FORM_ID%%_video-link">[cred_i18n name='video-link-label']Video Link[/cred_i18n]</label>
[cred_field field='video-link' force_type='field' class='form-control' output='bootstrap']
</div>
[/cred_show_group]
Link - hidden link
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Himanshu,
Thank you for getting in touch.
This is actually a known issue and to work around this you will need to use a generic field to house your taxonomies. Then do your conditional based on the generic fields.
The idea is to provide the ID as the value of the generic field and for the title you can just use the taxonomy title.
From there you can hook into the Form when it is submitted to get what value was selected and then use the function below to set the correct term onto the post.
https://developer.wordpress.org/reference/functions/wp_set_post_terms/
Please let me know if this helps or if further clarification is needed.
Thanks,
Shane
Thanks, Shane. Is there a timeline for making this fix happen?
Shane
Supporter
Languages:
English (English )
Timezone:
America/Jamaica (GMT-05:00)
Hi Himanshu,
I checked on our internal ticket for this but there isn't any ETA on this one at the moment.
Thanks,
Shane