Skip Navigation

[Resolved] How to accordionize /collapse-uncollapse the four level taxonomy in a form

This support ticket is created 5 years, 9 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Author
Posts
#1194734

Tell us what you are trying to do?
I am trying to make the hierarchical taxonomy (four levels) colapsilbe/uncollapsible in a form / add new post, and I have found the below indications in your forum and its working but just one level. Could you please let me know what shall I add on the js Custom code to make that work for a 4 level hierarchy taxonomy? Thank you a lot!
Valentin

<div class="form-group accordionize">
<label>Statuses</label>
[cred_field field='status' display='checkboxes' output='bootstrap']
[cred_field field='status_add_new' taxonomy='status' type='add_new']
</div>
Now in the custom JS add the following code:
( function( $ ) {
$( document ).ready( function(){

// first hide the children
$("[class*='tax-children-']").hide();

// now add a change event handler to the parent inputs
$(".accordionize ul.wpt-form-set-checkboxes > li.checkbox input").change( function(){

// parent changed, toggle its children
$(this).parent().parent().next("[class*='tax-children-']").toggle();

});

});
})( jQuery );

Is there any documentation that you are following?

Is there a similar example that we can see?

What is the link to your site?

#1195117

Hi, please note in Nigel's reply that extending this example code is outside the scope of support we provide here in the forums - https://toolset.com/forums/topic/set-parent-child-taxonomy-in-accordian/#post-903678

...please bear in mind that providing custom code is outside of our support policy and if you need help expanding on the solution you would need to consult a developer.

That support policy is available for you here: https://toolset.com/toolset-support-policy/

If you have questions about applying these concepts to a multi-level term hierarchy, you may need to consult a JavaScript / HTML developer. We have a portal available where you can connect with independent professionals: https://toolset.com/contractors

#1196602

Hi Christian, actually I wanted to ask what are the shortcodes and Js used by CPT uses for the relation children grandchildren. The above solution is for parent-children and I need to do the same thing for the 2-nd and 3rd level taxonomy. Appreciate your help. Thx. Valentin

#1196842

I wanted to ask what are the shortcodes and Js used by CPT uses for the relation children grandchildren.
Sorry, I'm not able to understand your question. Could you give me more information about what you need to accomplish? We also have references for Toolset shortcodes available at these links:
https://toolset.com/documentation/user-guides/views-shortcodes/
https://toolset.com/documentation/customizing-sites-using-php/functions/
https://toolset.com/documentation/user-guides/cred-shortcodes/

#1197874
Screen Shot 2019-02-08 at 17.20.04.png

Hi Christian, Thank you for the availability to help.
I have a taxonomy (category) with 4 levels (Parent-Child-grandchild-2grandchild) - image attached.
I would like to display in a front-end form, initially just the first two (Construction (parent) and Construction of Buildings (child)) and the other two to uncollapse by click the above category.
The other alternative is that every sub-category to be uncollapse after clicking the above one.
Please help me with any of the options Thx
Valentin

#1198209

I understand what you want to accomplish, and I've already provided feedback about this. You have the example code from Nigel. Extending that example code to your specific needs is outside the scope of support we provide here. If you need more help with that type of customization, you may be able to connect with an independent professional in our Contractors area who can help you with this. https://toolset.com/contractors/

Here's our support policy:
https://toolset.com/toolset-support-policy/

#1205418

x