Navigation überspringen

[Gelöst] Custom select field that pulls titles from a content type

This support ticket is created vor 3 years, 1 month. 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.

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 -

Zeitzone des Unterstützers: Asia/Hong_Kong (GMT+08:00)

Dieses Thema enthält 3 Antworten, hat 2 Stimmen.

Zuletzt aktualisiert von brettB-4 vor 3 years, 1 month.

Assistiert von: Luo Yang.

Author
Artikel
#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: versteckter Link
1) Create two one-to-many relationships between post types "Teams" and "Matches":
versteckter Link
- Teams A Matches
- Teams B Matches

2) In the single "Match" post:
versteckter 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:
versteckter 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!