I think you have misinterpreted custom post-types and custom taxonomies, somewhat.
Theory
Custom Post Types
I consider the purpose of a custom post-type to be format of data distinct in it’s own right – it describes a type of content, but not the content itself. Take the in-built page
, post
, and attachment
post-types, for example:
- The
page
post-type describes the format of a generic, static page on a website that may be organized into a hierarchy using parents. - The
post
post-type describes timely content that may be organized with
categories and tags that reflect the nature of the content itself, and generally emphasize community with comments. Posts are also published in RSS feeds for visitors to digest externally. - The
attachment
post-type describes a media file which is associated with one of the aforementioned post-types.
It wouldn’t make sense to publish “About Us” content as a post
(the chronology of when the content is published is irrelevant, and it is unusual to have a comments section on such static content), nor would it make sense to publish a news story as a page (it is important when the story was published, and it would be useful to use taxonomies to describe what type of story it is). Neither piece of content could reasonably be published as an attachment
.
It would be even stranger to create a unique post-type for each piece of static content (an “About Us” post-type, a “Contact Us” post-type, a “Privacy Policy” post-type, etc.) as each piece of content could be described in an identical format.
Any data relevant to a custom post-type is most frequently stored and accessed via the Metadata API, which allows you to attach custom information to posts.
Custom Taxonomies
A taxonomy is nothing more than a method of grouping items together. In practice, you can taxonomies to organize varieties of content, or to reflect certain aspects of content – whether that content is described with the same post-type, or different ones.
A site listing television shows and movies may have a custom post-type for both (as an episodic television show is described in a different manner than one describes a movie), but entries of either could be classified using the same genre
taxonomy (the entries or “terms” of which would contain things like “sci-fi,” “horror,” “action” etc.).
Application
Hockey, basketball, and football are all by definition a type of sport, and therefore can be described in the same format as any sport can (a name, a ruleset, a history, etc., for example). As a result, it follows that you should create a single sport
custom post-type, and create three individual entries of the sport
post type to represent each individual sport.
By the same logic, it stands to reason that a single athlete
post type will sufficiently encompass participants in all sports, and a single event
post type will address any event for any sport, athlete, etc.
sport
s could be organized with a taxonomy that describes the type of sport – i.e. “spectator sport”, “team sport”, “competitive sport”, “amateur sport”, “water sport”, “professional sport”, etc. However, for your application this is unnecessary.
Events are organized (or grouped) by location, so it makes sense to have a location
taxonomy that applies to the event
post-type. It could be hierarchical by geography (state or province terms having city terms as children, for example) – allowing you to query events by city or region – or simply flat-level like a tag.
Both events and athletes may be organized according to their associated sport, so it makes sense that in addition to the sport
CPT, a sport
taxonomy would be created (and not applied to the sport
CPT. Alternately, the Metadata API could be used to associate items with the respective sports
CPT entry.
However, from your description, it sounds as though you are not interested in describing any of the sports on your site – you have no need for actual pages detailing aspects of a sport independent of the people, places, and events related to it. As a result, it would make more sense to not have a sport
CPT at all, and rather only a sport
taxonomy, allowing you to group athletes
and events
by their respective sport.
Summary
I believe the best way to organize your content is as follows:
- Custom Taxonomies
sports
locations
- Custom Post-Types
athlete
– uses thesport
taxonomyevent
– uses thesport
andlocation
taxonomies
A query with the following arguments returns the archive page containing all athletes participating in football:
$args[ 'post_type' ] = 'athlete';
$args[ 'tax_query' ] = array(
'taxonomy' => 'sport',
'terms' => 'football'
);
This query is always available at the URL
/?post_type=athlete&taxonomy=sport&terms=football
How that translates into a pretty-permalink is dependent on your permalink settings and the slugs you chose.