Tell us what you are trying to do?
I have form for creating a new post, and I would like certain sections to appear only when a given taxonomy is selected in the form.
ex) I select the term "Restaurant" and a field appears, "Restaurant Specialty"
Is there any documentation that you are following?
I started here: https://toolset.com/documentation/programmer-reference/forms/cred-conditional-display-engine/
This page states that taxonomies can be used, but does not go into enough detail.
On further research I found plenty of documentation for wpv-conditional statements, and even found that they can do exactly what I want in the GUI, but eventually found that they seem to operate slightly differently than cred-show-group conditionals, and I cannot use shortcodes in the same way. https://toolset.com/documentation/user-guides/views/conditional-html-output-in-views/displaying-taxonomies-conditionally/#one
Before creating this ticket I performed a search and came across this case, which is very similar to mine, however my terms seem to have text slugs, not IDs, despite the taxonomy being hierarchical (perhaps I am misunderstanding how to check; I cannot find terms in wp-admin) https://toolset.com/forums/topic/dropdown-does-not-affect-visibility-of-fields/
Hello,
You can try to check with term name, for example:
[cred_show_group if="( $(category) eq 'Uncategorized' )" mode="fade-slide"]Display something[/cred_show_group]
Please replace "category" with the custom taxonomy slug, replace "Uncategorized" with your specific term's name, and test again
Hi Luo,
Thank you for the response. I have tried with both term name and slug, and it still does not work. This was originally taken from a larger form made with the GUI editor, but I isolated it down to just this much to test:
[credform]
[cred_field field='form_messages' class='alert alert-warning']
<div class="form-group">
<label>Listing Types</label>
[cred_field field='listing-type' force_type='taxonomy' output='bootstrap' display='select' single_select='true']
[cred_field field="listing-type_add_new" taxonomy="listing-type" type="add_new"]
</div>
[cred_show_group if="( $(listing-type) eq 'Tourism' )" mode="fade-slide"]
<div class="form-group">
<label>Restaurant Specialty</label>
[cred_field field='restaurant-specialty' force_type='field' class='form-control' output='bootstrap']
</div>[/cred_show_group]
[cred_field field='form_submit' output='bootstrap' value='Submit' class='btn btn-primary btn-lg']
[/credform]
Edit: I would love if there was a debug option for this, like in the wpv-conditional statements
Thanks for the details, since you are using single select dropdown for the taxonomy field, you can try to compare the value with term's ID, for example:
[cred_show_group if="( $(listing-type) eq '123' )" mode="fade-slide"]
...
[/cred_show_group]
Please replace 123 with the taxonomy term "Tourism" ID, you can get the term's ID by edit it in WordPress admin side, see screenshot: tag_id.JPG
That worked, thank you very much !