[wp-hackers] Advice regarding Custom Post Types and Taxonomies

Otto otto at ottodestruct.com
Thu Aug 9 21:30:29 UTC 2012


On Thu, Aug 9, 2012 at 12:18 PM, Mike Walsh <mpwalsh8 at gmail.com> wrote:
> I am working on a new site for my daughter's soccer team and have decided
> to use it as an opportunity to learn more about Custom Post Types and
> Taxonomies.  I have the basics working - I have defined a post type for
> players and another post type for teams and each have a number of custom
> fields based on what the team wants to track for each player and at the
> team level.  I have also defined a taxonomy for player positions so the
> players can be looked at by position.  I am struggling with how to define a
> roster for a team and connect the player CPTs to the team and/or roster.
>  Should the roster be a taxonomy or should the team CPT be hierarchical and
> each roster is a child of the parent team?

I think the real question is why would a "team" be a post type? A team
is essentially a group of players, wouldn't it make more sense as a
taxonomy?

If you need to define a post type for the team in order to have stuff
about that team in the posts-table (totally understandable), then I'd
associate the team-post to the team-taxonomy in an implicit manner,
perhaps by sharing the postname and the term-slug. Essentially, the
players and the team would both have the same terms in the
team-taxonomy.

-Otto


More information about the wp-hackers mailing list