How to set up an entity (post-type?) with many dependent entities (more post-types?)

I want the wordpress CMS to manage a new type of content called Athletes. The data structure for Athlete would be as follows:

Athlete.name
Athlete.date_of_birth
Athlete.profile
etc...

An athlete will also have a photo gallery. So in a typical relational database design, you will have something like

Read More
Athlete_Gallery.id
Athlete_Gallery.athlete_id
Athlete_Gallery.file_name

An athlete will have also participated in many tournaments. So in a typical relational database design, you will have something like:

Athlete_Tournament.id
Athlete_Tournament.athlete_id
Athlete_Tournament.tournament_name
Athlete_Tournament.win_or_loss
Athlete_Tournament.score
Athlete_Tournament.weight_class
etc...

An athlete will also have list coaches he has trained under, following a db schema similar to Athlete_Tournament.

What is the best way to set up a CMS that will manage such a data structure? Which plugins will I need?

ADDITIONAL NOTES
I looked at Pods but the steps for creating dependent records is not optimal. If I want to record the fact that John won the 2001 City Tournament, I currently need to:

  • go to a tournament page
  • create 2001 City Tournament
  • go to John page
  • relate John to the 2001 City Tournament record
  • save

This is not ideal. Instead, I want to:

  • go to John page and see a section called tournaments
  • add the 2001 City Tournament
  • save

Pods doesn’t seem to do this out of hte box….please correct if i’m wrong. Thanks

Related posts

Leave a Reply

2 comments

  1. You want Posts 2 Posts which is a phenomenal way to efficiently relate different content types in WordPress.

    Combine that with with some custom meta boxes with your fields and you’ve got a very nice, usable system that does what you want. There are plenty of tutorials out there on creating custom meta boxes.

    So let’s say you have the following post types:

    • athlete
    • athlete_gallery
    • athlete_tournament
    • coach

    You relate each with a Post 2 Posts relation:

    <?php
    add_action('p2p_init', 'wpse59137_connections');
    function wpse59137_connections()
    {
        // athletes to galleries
        p2p_register_connection_type(array(
            'name'  => 'athlete_to_gallery',
            'from'  => 'athlete',
            'to'    => 'athlete_gallery',
        ));
    
        // athletes to tournaments
        p2p_register_connection_type(array(
            'name'  => 'athlete_to_tournament',
            'from'  => 'athlete',
            'to'    => 'athlete_tournament',
        ));
    
        // athletes to coaches
        p2p_register_connection_type(array(
            'name'  => 'athlete_to_coach',
            'from'  => 'athlete',
            'to'    => 'coach',
        ));
    }
    

    What you get from the above is a few meta boxes in the admin area to create relationships. Those boxes are also highly customizable, so be sure to check out the docs.

  2. For this, I’d use Pods CMS.

    It allows you to quickly create custom content types that can relate to each other, and other WordPress object types.

    The advantage over WordPress custom post types is that it actually creates MySQL tables for you with unique column types mapped to your data. It then allows you to define relations to other “Pods”.

    I’ve found Pods CMS much easier and more useful to work with performance and time wise than custom post types, custom fields, and various plugins for trying to relate them to each other. You can do all this by adding custom fields that hold the ID of the other custom post type, but it gets ugly and messy, and isn’t your typical relational DB scheme.

    I wish I had more time to write about the uses personally, but in short, here’s a useful overview and excerpt:

    Calling Pods a ‘plugin’ is an understatement. It’s one of those WordPress plugins that does so much more than provide some functionality to work with that makes your life a bit easier or makes WordPress that much more useful.

    Pods has changed the way I work with WordPress. Pods has allowed me to truly use WordPress as the content management system it was born to be. While a ton of great stuff is happening in the core, Pods is giving us what we need to work with today, and it’s spectacular.

    • The above is from the Pods CMS overview article by Jonathan Christopher of Monday by Noon

    P.S. I would link some more, but I can only add 2 links. Monday by Noon’s series is by far the best introduction to Pods CMS I’ve seen. I’ve done some awesome things with Pods CMS, including a custom shopping cart, event registration systems, etc… it’s VERY flexible and powerful.

    Good luck!