Skip Navigation

[Resolved] Many to many 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 21 replies, has 2 voices.

Last updated by Minesh 4 months, 2 weeks ago.

Assisted by: Minesh.

Author
Posts
#2705835

Hi,
I have a site with companies. Every have a taxonomy for ex. "museum".
I want to add taxonomy for localization (city for ex.).

How to create relationship between those taxonomies? I want to have a page
domain.com/city/museum
which will show only posts from specific city and museums only.

But museum can be at city2 so other site will be
domain.com/city/museum

and so on.

#2705914

Correction of TYPO:

But museum can be at city2 so other site will be
domain.com/city2/museum

#2706050

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

There is no such feature available to add taxonomy term with post type slug and build the URL.

You may consider any Permalink plugin that support such URL customization or check the following link:
- hidden link

You should try any of the following plugin to build the permalinks as required:
- https://wordpress.org/plugins/wp-better-permalinks/
- https://wordpress.org/plugins/permalink-manager/
- https://wordpress.org/plugins/custom-permalinks/

#2706101

Hi Minesh,

I will handle permalinks. I'm more waiting for answer how to build taxonomy many to many relationships.

#2706105

Minesh
Supporter

Languages: English (English )

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

You can build post-relationship using native or custom post types.

When you create "Many To Many" post-relationship between two post type, it will automatically create intermediary post type where you can add custom field.

So, if possible, you should add custom field to intermediary post type rather then using taxonomy. As taxonomy not supported for intermediary post type.

Please check the following Doc.
- https://toolset.com/course-lesson/many-to-many-post-relationships/

#2706206

OK, I see your point but still have a question.

Let's say I buid Localization post type. Now I have "location1", "location2", "location3" and so on.
If I create many to many relationship with every company then on location site I can show all companies from that location.

But I want to have one more step for ex.:
location1 -> museum -> museum1, museum2
location2 -> museum -> museum3, museum4

As for now every museum has type "museum" in taxonomy.
So maybe it is possible to link locations to companies but on location site instead of list of companies show taxonomy list of companies from such location?

#2706207

And of course every taxonomy should be a link to specific list.

#2706286

Minesh
Supporter

Languages: English (English )

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

Well - its still not that clear, I understand about post type companies and locations should have many to many post-relationship and in that case:
- on single X location you can display related companies
- and on single X company you can display related locations

I'm still not sure how you want to inject the museum.

You said:
- As for now every museum has type "museum" in taxonomy.
===>
Have you setup "museum" as custom post type and with this post type you have custom taxonomy as well, for instance taxonomy "museum-names" asssigned to post type "museum"?

if I consider "museum" as custom taxonomy, to what post type you are planning to assign? is it to location post type or company post type?

I'll require bit more details about your structure so that I should be able to guide you in right direction. You many share couple of real like example with dummy post types and taxonomies. If you want sandbox site, please let me know, I'm happy to share sandbox site where you can setup all those post types and taxonomies with dummy data that will help me to guide you in the right direction.

#2706555

Let's have an example.

I have:
"Location1" where I have "Museum1", "Museum2", "Pool1", "Pool2", "Park1".
"Location2" where I have "Museum3", "Pool3", "Museum4", "Pool4".

I setup many to many between Companies (museums, pools, parks) and Locations just as above.

Now on "Location1" I want to have list of positions:
"Museums" which links to "Museum1", "Museum2".
"Pools" which links to "Pool1", "Pool2".
"Parks" which links to "Park1".

On "Location2" I want to have list of positions:
"Museums" which links to "Museum3", "Museum4".
"Pools" which links to "Pool3", "Pool4".

Positions "Museums", "Pools" and "Parks" can be linked via taxonomy.

#2706785

Minesh
Supporter

Languages: English (English )

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

Ok so - as you adding all three types of Companies (museums, pools, parks) and to identify what post belongs to what position (museums, pools, parks) - what if you assign taxonomy to Companies post type.

Then we can identify what post belongs to what position based on the company post and assigned taxonomy belongs to company post - does that makes sense?

#2706913

Yes, that's the goal. Now I need a way to do it 😀

#2707002

Minesh
Supporter

Languages: English (English )

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

Have you assigned the taxonomy to Company post type and also set the related term for the company post so we can identify what post belongs to what taxonomy term ("Museums", "Pools" and "Parks")?

If yes - is it possible for you to send me problem URL and admin access details or if you want I can share sandbox site where you can setup all those post types and taxonomies with few sample data and get back to me and I will try to build and demonstrate the solution on the sandbox site.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2707529

Minesh
Supporter

Languages: English (English )

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

I see you created three company posts and to each post three taxonomy term assigned.

So, on the following location sing post:
- hidden link

Do you expect the results to be displayed as follows:
- Centrum nauki
--- Centrum Nauki Kopernik

- eksperymenty naukowe
--- Centrum Nauki Kopernik

- warsztaty edukacyjne
--- Centrum Nauki Kopernik

- atrakcje dla dzieci
--- Miejski Ogród Zoologiczny

- atrakcje plenerowe
--- Miejski Ogród Zoologiczny

- Ogród zoologiczny
--- Miejski Ogród Zoologiczny

- przyjęcia urodzinowe
--- Sala Zabaw Smyk

- Sala zabaw
--- Sala Zabaw Smyk

- zajęcia z animatorem
--- Sala Zabaw Smyk

If no, Please clarify if you have different requirement.

#2707535

Almost.
On the following location sing post:
- hidden link

I expect the results to be displayed as follows (links):
- Centrum nauki
- eksperymenty naukowe
- warsztaty edukacyjne
- atrakcje dla dzieci
- atrakcje plenerowe
- Ogród zoologiczny
- przyjęcia urodzinowe
- Sala zabaw
- zajęcia z animatorem

All links will follow to set of pages with given taxonomy for ex.:
"Centrum nauki" will link to list of pages where "Centrum Nauki Kopernik" will be (and others with this taxonomy and relationship to "Warszawa").

#2707536

Minesh
Supporter

Languages: English (English )

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

"Centrum nauki" will link to list of pages where "Centrum Nauki Kopernik" will be (and others with this taxonomy and relationship to "Warszawa").
===>
For this you want to create separate page or you want to use post type archive for post type "Company" or taxonomy archive for taxonomy "Rodzaje"?