2 Tier research:
I am building a site for a client that specializes in research travel. They offer 2 tiers of research assistance, “Standard” and “Premium”. Each of those levels of service have occupancy variations, such as Single or Double. Although these features share names and other attributes, they are specific in price per trip.
Custom Post Type w/o taxonomy
I’ve made a custom post type for “Trip
” and Trip has child post types called “Packages
“. I’m not looking for a magical solution to sort it all out; I don’t mind (nor does the user) adding each combination as a line item.
I can create Trip
s and Package
s this way just fine and relate them accordingly. However, out of the box (not using taxonomy), the URLs are something like this:
http://exmple.com/trips/fall-2012/
– this displays the details of the trip. I have a custom content template to display its child packages defined above accordingly.http://exmple.com/packages/
– this lists out ALL packages that I’ve created for all my trips. Packages with the same name (i.e. Single Registration) end up like/packages/single-registration-2/
and/single-registration-3/
The needed combinations
This is not helpful because I am not interested in seeing all 8 different combinations of packages. A combination would be:
trip
–service level
–occupancy
Examples
What I’d really like to see is:
http://exmple.com/trips/
– this would display all top level trips, such as Fall 2012, Spring 2013, Fall 2013http://exmple.com/trips/fall-2012/
– this would display all packages for that trip. All combinations of service level and occupancy. This is really as far as I would need to go. I plan on offering a list of all packages here and allowing the user to choose one.
Just logically speaking, the rest of the URLs would look like this (although I dont plan on needing to navigate this deep)
http://exmple.com/trips/fall-2012/standard/
http://exmple.com/trips/fall-2012/standard/single-occupancy/
http://exmple.com/trips/fall-2012/standard/double-occupancy/
http://exmple.com/trips/fall-2012/premium/
http://exmple.com/trips/fall-2012/premium/single-occupancy/
http://exmple.com/trips/fall-2012/premium/double-occupancy/
I really hope I made some sense.
First I would create a new custom post type called Trips. Add this to your theme’s functions.php
}
Then I would create a new custom taxonomy called ‘tripdetails’. Add this to your theme’s functions.php
You’ll be able to then fill your custom taxonomy with terms and sub-terms of your own choosing.
Then when you create a new ‘Trip’ using your brand new custom post type you can simply tag it with terms and sub-terms from your brand new custom taxonomy.
You’ll end up with URLs like this (which will contain a list of your ‘trips’ which have been tagged with the appropriate terms)
http://example.com/tripdetails/top-level-term/second-level-term/