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.