0

I have three custom post types: cartoon-series, episodes, and special-features.

Right now I have cartoon-series posts set to be post-parents of episodes and special-features posts. That's the only way I could figure out how to associate episodes/special-features with a particular cartoon series. I could have set up cartoon-series as a taxonomy, but the cartoon series themselves have data, like a description, gallery, etc.

The problem I'm running into now is the compounding complexity of the rewrites (and also a breadcrumb that I won't get into right now). At first I had a rewrite set up for episodes to add the post parent into the url: domain/cartoon-series/<series>/<episode-name> Which worked, but when I added special-features, I realized its rewrite looked exactly the same, so naturally, Wordpress was confused by this. I then attempted to add the post type name into the rewrite to differentiate the two CPTs: domain/cartoon-series/<series>/episodes/<episode-name> But, I must be doing something wrong because the rewrite isn't being read correctly looking at it with Rewrite Analyzer.

All of that complexity is making me wonder if I am tackling this in the best way. So, I am looking for any advice on a better way to look at it.

One more level of complexity is that special features may have several different types of content, like galleries, narratives, videos, etc. So, I'm not sure if I should somehow make Special Features a taxonomy or something like that and then have different post types assigned to the special-features taxonomy. It's complicated!!! :-D

Cartoon Series  
|  |Would have data related to the series, itself (narrative, gallery, etc)  
|---Episodes  
|   |---Episode Synopsis and galleries
|---Special Features
    |---Different types of posts (galleries, narratives, videos)

The only other thing I have thought about doing is making cartoon-series a taxonomy with episodes and special-features being sub-terms of the terms for the series names. Then maybe I could set up a CPT that would mirror the names of the top-level cartoon-series terms to hold the extra data that a taxonomy term can't hold (something I've never done).
One bad thing about this approach is that many users will be inputting the data and all of those options for where to put a post may get crazy. For instance, someone may put an episode under special features since all of those term options would be available in the same selection meta box.

Thanks for any help provided!

0

Ok, that is complicated :-) Have you considered using rewrite endpoints?

I would not try and cram everything into the url unless you have a specific need or a requirement for that.

domain/<series>/<episode-name> would be going directly to the episode CPT

domain/cartoon-series/<series> - would go the the series CPT

Then using rewrite endpoints to have features for these urls:

domain/cartoon-series/<series>/gallery

domain/cartoon-series/<series>/description

You would add something like this to allow these (/gallery and /description) endpoints:

function add_endpoints() {
    add_rewrite_endpoint('gallery', EP_PERMALINK);        
    add_rewrite_endpoint('description', EP_PERMALINK );        
}
add_action( 'init', 'add_endpoints', 0);

And have code to handle the endpoints in the default CPT template for cartoon-series.

Another way would be to do what you already considered, which is, setup cartoon-series as a taxonomy and then use the rewrite endpoints and parse them in the category.php file?

I hope this helps you in some way.

**Another Option

Don't create a CPT for Cartoon Series. Leave it as a category that it can be used in both Episode CPT and Feature CPT:

Categories Series Series1 Series2 Series3

Episode CPT Special Features CPT

domain/cartoon-series/<series> - displays the category page (would list episode CPTs and feature CPTs) as well as pull domain/cartoon-series/<series>/episodes - category page listing just episode CPTs (where "episodes" is a rewrite endpoint) domain/cartoon-series/<series>/features - category page listing feature CPTs (where "features" is a rewrite endpoint)

The above would be rendered based on logic in category.php Then

Episode CPT would be mapped to /episode/ Feature CPT mapped to /feature/

The problem would be getting this to work:

domain/cartoon-series//episode/ - displays the Episode CPT domain/cartoon-series//feature/ - displays the Feature CPT

And of course you would need to somehow pull the info on the series as well.

  • HA! Imagine my brain just had a small explosion. :-D I haven't "considered" many options because I only started using WordPress at all in February. So, there are options out there that I don't even know exist, much less have I considered them. :-) I don't quite follow the need for the gallery and description end points. The gallery and description would be part of the cartoon series post. They wouldn't be posts unto themselves. Unless you mean those to be in place of special features. I'm lost. :-D – Mattaton Apr 7 '15 at 13:01
  • I'm also dealing with a breadcrumb that I mentioned in the OP. It's more important for this to have the complete chain than the url. I'm using the Breadcrumb NavXT plugin. It works great showing a taxonomy chain. SO, that lends itself on being the smartest way to tackle this: Try to develop a taxonomy for the cartoon-series, episodes, and special-features. It's how I link them all together that is perplexing. – Mattaton Apr 7 '15 at 13:09
  • I added some more thoughts but anyway you look at this it will be rather complicated since you have to keep in mind the admin experience and people adding new posts. Please post your solution when you come up with one i'm very interested in how you get this working. – td-lambda Apr 7 '15 at 17:16

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.