Skip Navigation

[Resolved] Many 2 Many with Taxonomy

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.

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

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 25 replies, has 4 voices.

Last updated by Minesh 2 weeks, 6 days ago.

Assisted by: Minesh.

Author
Posts
#2762856

Tell us what you are trying to do?
I have a content type called Song
I also have another content type called Person (they are for credits, ie. musician)
I have a taxonomy called Instruments

I want to have a m2m relationship between song and person (that's easy), but instead of extra fields, would like to use the instruments taxonomy so I use a consistent and reusable data source.

Is there any documentation that you are following?
No
Is there a similar example that we can see?

What is the link to your site?

#2763156

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

You can either add taxonomy to post types that you include in many-to-many post relationship.

The intermediary post type that will seat between your two many to many post type and you can not add taxonomy to intermediary post type. You can add only custom fields.

For instance you have post type X and post type Y, then you can assign taxonomy to both post type X and post type Y but when you create many-to-many post relationship it will offer you intermediary post type generated automatically lets say (manytomanyxy post type) that will seat between post type X and post type Y and you can not assign taxonomy to this intermediary post type.

#2763359

I understand that, but the point was to not have to, for example, write Guitar everytime. Also, if I wanted to see all the guitar player credits that's not possible. Taxonomy solves that if it could be linked in the M2M Intermediate post. Since you can't do that, I'll try something else. Drupal, did that BTW, so I know it's possible.

#2763492

Christopher Amirian
Supporter

Languages: English (English )

Hi,

This is Christopher. I'm here to inform you that Minesh will not be available today. He will answer the question tomorrow.

Most probably he will say that it is not possible with Toolset as it is what I also understand.

I appreciate your patience.

#2765288

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

As per the Toolset many to many post relationship you can add custom fields to intermediary post type that seats between the two post types of many to many post relationship hence its not possible to hook in taxonomy by to intermediary post type, only the custom fields are allowed. You can say its limitation by design of many to many post relationship.

#2765298

Okay, I'll try to work around it, but taking the example of A song has many credits (people), and credits are on many songs, can you think of anyway to use the custom field in the intermediate post to link them (i.e. look up all Joe Green credits?) That's mainly what I'm looking for.

#2765925

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Here is a sandbox site and you can auto-login to it using the following link:
- hidden link

Can you please create your post types, many-to-many relationship with intermediary post by adding custom field and add few posts and connect them in relationship and tell me on what post/page you want to display what and then I will be able to guide you in the right direction.

#2767262

Okay, that is there, I added some data. Also, I can never add a person more than once on a track with the instrument even with it set to multiple.

Basically, every song can have multiple musicians (people), and they can play on multiple instruments per track (which it won't let me do now). I would like to click on a person and find what tracks etc. they play on and what instrument, and from a data point, not have to type in instruments all the time, but that's a lesser problem.

#2769334

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

The thing is that - with Many to Many post relationship, Toolset doesn't support connecting the same posts more than once.

Please check the following related ticket that will help you to understand this in more detail.
- https://toolset.com/forums/topic/the-best-way-to-have-a-list-of-names-related-to-a-role-related-to-a-project/#post-2684097

#2777235

I will look at this. I'm working on something else for a different client, so give me a few days.

Thanks!

#2777371

Mateus Getulio
Supporter

Languages: English (English )

Timezone: America/Sao_Paulo (GMT-03:00)

Hello there,

Thanks for the heads up, please keep us in the loop about the status of this.

Thank you,
Mateus

#2777383

I don't see this as a solution. It's not as simple as actor/producer. It's for music so I could play guitar, bass, piano, producer, songwriter. My friend could also be guitar and songwriter. Maybe I'm reading something wrong.

#2777604

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - I'm not sure where exactly you stuck.

I've added the relationship field "Instrument play" as checkboxes field and added options to it as you can see with the following link:
- hidden link

Then I've edit the following Person post:
- hidden link

As you can see there is "Song 3" is the related post having "Instrument Play" custom field with values "Bass, Piano, Gitar".

Now, I've created the following single post content template to display the single person post:
- hidden link

Where I've added a single post title link at top and then added the view block that is set to display the related post in many to many relationship using the intermediary post type. Where with the view's loop I set to display the related tract post title link and then the "Instrument Play" custom filed.

As you can see on frontend, its displays the related track with "Instrument Play" for this single post person "bruce-thomson":
- hidden link

Please let me know what I'm missing here.

#2777684
Screenshot 2024-10-14 083107.png

It's asking for a login, so I can't see it.

In any case, here is a real example. I didn't use m2m but instead just added as a wysiwyg field.
Ideally, I would like to click on a name and have all the credits with the songs. I may be overcomplicating this.

#2777690

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Here is a sandbox site and you can auto-login to it using the following link:
- hidden link

On what page you want such link? on single person post?, for instance:
- hidden link

So, now, you can setup the flow and tell me what information you want to display on what page/post and I would be happy to guide you.