Skip Navigation

[Waiting for user feedback] Two different relationships between two CPTs

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 1 reply, has 1 voice.

Last updated by Christopher Amirian 1 week, 1 day ago.

Assisted by: Christopher Amirian.

Author
Posts
#2837974

I have two CPTS, "shows" and "highlights". i have a one to one relationship between them so that presenters can identify which show the highlight came from.

I would also like to have a one to many relationship between shows and highlights so that presenters can suggest other shows which might be of interest to someone interested in the highlight

Is there a way to have two distinct and different relationships between two custom post types? if not, is there another way to achieve what I want?

Thanks

#2837983

Christopher Amirian
Supporter

Languages: English (English )

Hi,

Welcome to Toolset support.

Yes, you can have two different relationships between the same two CPTs.

- Go to Toolset → Relationships and create two relationships between Shows and Highlights, for example:

show-highlight-main – one-to-one (main show for this highlight)

show-highlight-suggested – one-to-many or many-to-many (other shows suggested for this highlight)

- On the Highlight edit screen, you’ll now see two separate relationship boxes, so presenters can pick:

The main Show in the first relationship

Additional suggested Shows in the second.

In your Views/Templates, when adding a relationship query or block, make sure you explicitly select the correct relationship slug (show-highlight-main vs show-highlight-suggested) so each list shows the right shows.

Further reading:
https://toolset.com/2018/07/how-to-create-post-relationships-between-your-custom-post-types-and-how-to-display-them/

Thanks.