0

I want to set up a competition scoring site for horse competitions.

Each competition has many classes

Each class has 3 disciplines (show jumping, dressage and cross-country) that are scored independently of each other and totaled to create a final score with intermediary scores and placings after each discipline.

Each class has many horses

Each horse has a single rider

Each rider can ride multiple horses in all classes.

I would like to have custom fields for classes, riders, horses and competitions to store data relating to each item which suggests 4 custom-post-types for classes, riders, horses and competitions.

The only simple relationship is that each horse can only be ridden in one class.

Can I create many to many to many relationships? Or is that the wrong way to look at this.

I want to be able to show:

  • which horses a rider is riding
  • Which classes a horse is in
  • The competitors in each class with running scores showing the placings in that class

Finally I will have multiple Competitions.

I'm slightly at a loss how to build this either with plugins or otherwise.

1

I’m building something similar... I’ll explain my logic but keep in mind that this Question and my subsequent Answer may get downvoted because it’s all vague and theoretical and technically there’s probably more than one way to do it, so accepting the correct answer will be difficult. Anyway...

I’m building a soccer league management tool and the many-to-many relationship works along the same lines.

So what I did was try to flesh out the different relationships on paper and then determine which of them are custom taxonomies and which of them are custom post-types.

Off the top I would think that your classes (dressage, cross-country, etc.) would be taxonomies

The riders and horse can share the taxonomy, and could be custom post-types.

Not sure how much data you’re placing into the “Competitions” but that could be a taxonomy as well, unless you have to do a lot of work with them, then they’d need to be a CPT.

So, on a simple stream... I’d say you could set Rider A and Horse 12. Then assign them a their Class taxonomies. So both Rider A and Horse 12 are participating in Dressage.

Now, if the Competition is a taxonomy as well, let’s say the “Summer Sunrise Competition”, you can then assign that to both Rider and Horse.

Once you save the post, you could then generate a custom meta on either Rider or Horse (your choice depending on operational logic and internal processing)... that custom meta would take every combination of taxonomies and ask you to associate an entry from the other CPT.

So, let’s say you assign horses to riders most commonly...

You’d have the Rider A CPT.

Dressage Class Cross Country Class

Summer Sunrise Comp.

That would generate, after saving, 2 custom fields, where you would then assign a horse.

Rider A -> Dressage -> Summer Sunrise Comp. -> Riding Horse 12

Rider A -> Cross Country -> Summer Sunrise Comp. -> Riding Horse 8

Then on the CPT Post for Horse 12 & Horse 8, you’d provide a similar logic, except instead of letting the user input the Rider, you’d query the Riders based on matching taxonomies, and see who has Horse 12 assigned and then put a link to their CPT Rider Post.

(The above is all admin stuff.)

Anyway, without knowing all about the sport, that’s a basic outline of how I’d approach it.)

2
  • Thanks Tony. Would this account for a rider and horse combination taking part in different competitions but in each competition actually riding in a different class? Apr 18 '20 at 7:41
  • Works the same way... Rider->Class 1->Comp+Horse, then Rider->Class 2->Comp+Horse. The CPT admin screen would, on load, take each Class & Comp for the Rider and make a new Input to assign a Horse. Apr 18 '20 at 15:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.