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
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.