Home › Forums › General Issues › How would you structure this? › Reply To: How would you structure this?
You have several problems.
First off, you are going to find it extremely difficult, if not impossible, to have a bidirectional relationship inside a repeater.
You are also going to find in extremely difficult, if not impossible, to short players by a value in a sub field (Goals) of a repeater.
In addition to those it is impossible to relate 2 sub fields to each other and to matching fields of a relationship.
Player <=> Season
Player <=> Season <=> Goals
You are talking about relating one meta field with another meta field. There is nothing in WP that will allow you to related meta fields to each other.
The only way that I can think of to get these relationships working is
CPT => Season
CPT => Player
In addition to this you need something in them middle of these “Season-Player” or “Player-Season” This cold be done with another CPT or it could be done with by setting one of the other two post types as a hierarchical post type and using child post to link them up. For example child posts for each player that represents each season. I don’t know which would be better, but this would give you the relationships you’d need. “Player-Season” would hold just the goals for a season for just one player.
Player <=> Player-Season <=> Season
This is as far as I can think this out here. I can’t see all the details.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
ACF wouldn’t be so widely used in WordPress if it didn’t have some pretty amazing capabilities. In this article, we look at a few of the features we’ll discuss during “7 things you didn’t know you could do with ACF” at #WPEDecode later this month. https://t.co/5lnsTxp81j pic.twitter.com/Yf0ThPG1QG— Advanced Custom Fields (@wp_acf) March 16, 2023
© 2023 Advanced Custom Fields.