2

I have a hard time figuring out how to structure a site. The site is a news site for 3 different, but related sports: Skateboard, Snowboard and Surfing. Each Sport has typically Athletes, Event names, Locations, Brands, Photographers, Film Makers and Tricks attached to them.

Mostly we publish news about these sports through articles, pictures and videos, and what I am aiming for is to be able to extract data from these published items and present them on pages grouped with similar data.

An example: We have written an article about Tony Hawk (Skateboard Athlete) performing the first ever 900 (Skateboard Trick). We would like that article to be listed on a page called Skaters (Skateboard athletes) where all skaters are listed in an alphabetical order, where Tony Hawk has his own section under the skateboard category, and for the same article to be listed on a page called Tricks with other 900s and other skateboard tricks. But the article cannot be listed under e.g. Snowboard tricks or Surf Tricks.

The way I have set it up is that I made 3 Custom post types for each sport, and custom tags under each sport for Athletes, Event names, Locations, Brands, Photographers, Film Makers and Tricks, which means there are e.g. 3 different tags for Tricks (Skateboard Tricks, Snowboard Tricks and Surf Tricks).

However, I have come to realize that if I follow this system further, I would need 3 custom post types for image galleries, 3 custom post types for events and so on, just making the admin pretty unuserfriendly.

The alternative would be to set up a hierarchical category system, where e.g. skateboard is a parent category, Skateboard trick is a child category, and the various trick names would be grand children categories. However, that to my understanding, would create a long long list of categories to choose from in every post.

The best thing would be if I could just make a relationship between custom tags and child categories, instead of a relationship between custom tags and custom post types, but I understand that is not for wordpress.

So my questions is: What is the best structure for my site? Any ideas that are more userfriendly?

3

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.

sports 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 the sport taxonomy
    • event - uses the sport and location 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.

  • Thank you for answering in such a short time and with such a in-depth explanation. I am very grateful. – Bjeff May 2 '15 at 20:19
  • However, I am new to this and probably should have been more specific. The sports we are talking about are skateboard, snowboard and surfing. And my site is a news site covering competitions, interviews, new videos, industry news etc. So the main front page is a mix of news from those sports, and snowboard news also appears on the snowboard page etc. Each sport have "under pages", showing on the menu, such as a page showing skateboarders automatically generated due to their name tagged/listed in articles, pictures, and videos. So skateboarders would be the same as athletes (TBC...) – Bjeff May 2 '15 at 20:37
  • There are other terms as well: Event, Location, Trick, Photographer, Filmmaker, Brand, which should have the same behavior as Athlete. To try to explain, say Tony Hawk is mentioned in an article because he was the first person to do a skateboard trick called 900, I would like that article to show up on a page labeled under Skateboard -> Skaters. And likewise the same article should show under Skateboard -> Tricks. But they musn't show under Snowboard -> Tricks for example. The way I have set up the site now, will produce these results (I think), but it will be hell for contributors/freelancers – Bjeff May 2 '15 at 20:56

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.