Skip Navigation

[Cerrado] Relational Posts Types

This support ticket is created hace 10 años, 6 meses. 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.

This topic contains 9 respuestas, has 3 mensajes.

Last updated by Brent hace 10 años, 6 meses.

Autor
Mensajes
#11267

Maybe you guys can help me figure out the best way to do this. I have a Location custom post type and a Beer custom post type. I want to be able to create a location and relate the beers to a location. I currently have things set up sort of like the new relational posts tutorial that you guys have, with the child post type "Beer" relating to a "Location" custom post type which is the parent.

This is cool and all but I would like to be able to create a Beer only once and then relate that beer to multiple Locations instead of having to create new beers for each location.

Ideally I would like it work like this, when I add a new location I can choose from existing beers that I have already added. Is this even possible?

#11348

Anyone, any Ideas....

#11349

Dear Brent,

I would use the Beer as the main custom post type, so you that you add them only once. And then create a custom taxonomy for Locations. You would be able to tick several locations, add locations as you go and locations could also be hierarchical.

Please let me know if there is anything else that I can assist you with.

Regards.
Caridad

#11355

Yes I thought about that, but the locations custom post type has custom fields that I will need to display as well- Address, image, etc. Would that still be possible?

#11363

anyone?

#11380

Here is the site I'm working on: hidden link

2 things I'm trying to do:

1.I have created a 'Beer' custom post type that is listing the beers on this page:
hidden link
Users can rate the beers at the moment.

2.The On Tap page is basically listing my locations custom post type. I need to be able to relate the 'Beers' CPT in step 1 to one or many On tap locations.

In reviewing this
https://toolset.com/faq/how-do-i-associate-one-child-with-several-parents-of-the-same-type/

It would seem that I could do this, but I would really like some more input.

#11757

I'm assuming you've seen this post:
https://toolset.com/documentation/user-guides/creating-post-type-relationships/

There's also the excellent Posts 2 Posts plugin by scribu:
hidden link

I'm not with Types/Views support so that's as much as I have to offer for now 🙂

#11760

Thanks Joe for the response, yeah I hoping not to have to install any other plugins to do this. It seems like it would be easy to do with types and views but not so much when it comes to many to many relationships. Here is from another post about the same problem but I explain what I'm trying to in detail.

This is what I'm trying to do:

I have created a CPT called "On Tap" and one called "Beers". Both of these have custom field groups.

I have also set-up a custom taxonomy called "Beer List" which is attached to both of the CPT's above.

I have 2 pages that I am displaying this content on: On Tap and Rate It.

On the "On Tap" page I need to create a view that will return all my "On Tap" posts and also return a List of "Beers" that are associated with each. This is where I'm having trouble.

So according to this example:
(Select the same listing for the song-album combination. Now, you can query which songs belong to which album using this taxonomy.)
https://toolset.com/faq/how-do-i-associate-one-child-with-several-parents-of-the-same-type/

How would I set up my views structure to accomplish this on my On Tap page? What would be the views query settings?

Here's the page that i'm working on, I think I'm close to making it work.

hidden link

Right now if you click on one of the "See whats on tap" buttons, a list of beers appear but It is not filtering them per On Tap location which I need it to do.

The Rate It page will just return Beers with the ability to sort by custom taxonomies and rate beers..I think I got this page.

Please help.

#11763

Just to make this simple the main issue i'm having is this:

If I create a post type relationship, with the "On Tap" custom post type being the parent, and the "Beers" custom post type as the child. I would have to create new beers for each On Tap post. This will not work in my case because I have another page where I'm going to rate beers and would end up with a bunch of duplicate beers in that view. If anyone knows a way around this please chime in.
Thanks

#11801

see this post for resolution information:
https://toolset.com/forums/topic/many-to-many-relationships-2/

El debate ‘[Cerrado] Relational Posts Types’ está cerrado y no admite más respuestas.