Skip Navigation

[Resolved] Taxonomy term select

This support ticket is created 3 years, 8 months ago. 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.

Our next available supporter will start replying to tickets in about 8.53 hours from now. Thank you for your understanding.

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

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Shane 3 years, 8 months ago.

Assisted by: Shane.

Author
Posts
#1983743
taxonomy example.png

Tell us what you are trying to do?
Whats the easiest/best way to accomplish something simular to the attached image in a cred post form?

One taxonomy. When click at the parent, the children of that parent populates a as a multi select.

It does'nt need to be exactly like the image but I want a dropdown with parents and a multi select of the children

Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?

#1983895

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Tobias,

Thank you for getting in touch.

From your screenshot I see that you want to have your Parent taxonomy terms and Child taxonomy terms to be separate filters.

Unfortunately this won't be possible to do without some form of custom code. The main reason is that the Parent and Child terms are a part of the same Taxonomy so they cannot be separated into 2 separate fields.

The only way I see this possible is by manually creating the Taxonomy fields on the form with the same Name/Slugs of the terms on the backend and using custom code to manually populate the taxonomy term of the created posts using our Toolset Forms hook to pickup the field data.

Given that it would involve the use of custom code, I won't be able to assist with this since it would be out our support scope.

Thanks,
Shane

#1985673

Hi
Ok, I see your point.

I have about 25 parent terms with children term assigned to them. This means that the dropdown select will be very long and not so user friendly. Is it possible to accomplish something simular to the image in the same field, like levels

What would be the best workaround do you think?

#1987057

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Tobias,

Yes it is possible to achieve this, however it will involve the use of custom code.

What you will essentially need to do is to split the taxonomies into different dropdowns on your form using the Generic Form Fields option, populating one field with all the Parents. This would mean populating all 25 Parent terms into a Generic field with their Names as the display and the ID as their values.

Then you will need to do the same for each child term and wrap those child term fields into a conditional statement.

When you do this then the child fields will be dependent on the Parent dropdown selection rather than having all the fields display at once.

Finally you will need to write a custom hook to get the terms that were selected and then manually set the taxonomy terms to the post using this function.
https://developer.wordpress.org/reference/functions/wp_set_post_terms/

You can hook into the form submit using the hook below.
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

Thanks,
Shane