Skip Navigation

[Resolved] Custom select field that pulls titles from a content type

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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 2 voices.

Last updated by brettB-4 1 year, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#2604263

We have a custom content type called Teams. We have another custom content type called Matches. We would like to have two select fields within the Field Group for Matches that will have all the post titles from the Teams content type as the selectable options.

You have helped with something similar for another site I handle that uses Toolset so I know this can be done. But I tried copying over some of the previous code you helped us with and I couldn't get it to work.

If you can help with getting this set up it would be appreciated.

#2604307

Hello,

In your case, it needs two one-to-many relationships between post types "Teams" and "Matches"

See below sandbox website:
Login URL: hidden link
1) Create two one-to-many relationships between post types "Teams" and "Matches":
hidden link
- Teams A Matches
- Teams B Matches

2) In the single "Match" post:
hidden link
You can connect it with different "Teams" posts
And display them like this:
[wpv-post-link item="@team-a-matches.parent"] VS [wpv-post-link item="@team-b-matches.parent"]

See the result here:
hidden link

In single "Teams" post, you can follow our document to display the related "Match" posts:
https://toolset.com/course-lesson/displaying-related-posts/#displaying-many-related-items

#2604377

This worked perfectly as well. I like that defining the teams is done through the relationship instead of with a custom field, because the relationship was going to have to be done anyway. This eliminates the need for the extra fields.

Thanks a bunch!!!

#2604379

My issue is resolved now. Thank you!