Skip Navigation

[Résolu] How to add more than one Parent to a Child post

This support ticket is created Il y a 6 années et 12 mois. 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

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

Last updated by Beda Il y a 6 années et 12 mois.

Assisted by: Beda.

Auteur
Publications
#523502

Hi. My client's website uses Woocommerce to sell and quote machines. We've set up two CPTs using Types: Companies and Contacts. Machines (woo products) use the product taxonomy; we've added the Woo product taxonomy to Companies and Contacts so we know what Machine categories each one is associated with.

We've set up relationships so that the Parent is the Machine. Its child is Company (Machines are 'owned' by a Company) and Contacts are children of Companies.

I have a CRED form where we add a new Company. At the bottom of that form (built with the auto-generate function and tweaked a little in terms of labels), there is a drop down that lets the admin select the associated Machine. Here's my question: I would like to offer the ability to select more than one Machine. I think a multi-select would be too unwieldy so I'd like the ability to have a + as an option to add more Machines.

Once this form is done, I want to be able to edit an existing company and add more Machines as their children. As a side note, I will build a CRED form to add a Machine (adding a new product to WooCommerce) along with Post Fields which will necessarily give the option to assign a Company to that Machine.

Can you guide me on how to do add the option to add additional Machines to a new Company (that I'll use on the edit a Company form too)?

The CRED form is here: hidden link

here is the code to add the machine to the company:

<div class="cred-group cred-group-parents">
		<div class="cred-field cred-field-_wpcf_belongs_product_id">
			<label class="cred-label">
		Select the Machine associated with this Company.  Type any part of the Machine title to search.
		</label>
			[cred_field field='_wpcf_belongs_product_id' value='']
		</div>

Thank you.

#523688

You cannot add more than one parent each Child post.

You can add only one parent of the same post type for each child post.

In a future version of Types, this will be possible, but this is still under development and I cannot state an ETA yet.

You could try a Many to Many relationship as elaborated here:
https://toolset.com/documentation/user-guides/many-to-many-post-relationship/

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.