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 Trips and Packages 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


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 2013
  • http://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.

  • So essentially you want to assign your post type to a taxonomy (one or more) and have that appear in the permalink structure. In that case the following answer may help you located HERE until someone else wants to chime in. Though there's a bunch of Q&As that address this very problem. Let us know if that thread is of any help to you. – Adam Apr 19 '12 at 15:10
  • My Google-Fu is inferior. I will read up and report back. – Honus Wagner Apr 19 '12 at 15:24

First I would create a new custom post type called Trips. Add this to your theme's functions.php

//trips Custom Post Type
add_action( 'init', 'create_trips_post_type' );
function create_trips_post_type() {
register_post_type( 'trips',
        'labels' => array(
            'name' => __( 'Trips' ),
            'singular_name' => __( 'Trips' )
    'public' => true,
    'has_archive' => true, 
    'hierarchical' => true,
    'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'custom-fields', 'excerpt'),
    'rewrite' => array('slug' => 'trips'),


Then I would create a new custom taxonomy called 'tripdetails'. Add this to your theme's functions.php

//tripdetails custom taxonomy
function tripdetails_init() {
// create a new taxonomy
        'label' => __( 'Trip Details' ),
        'sort' => true,
        'args' => array( 'orderby' => 'term_order' ),
        'hierarchical' => true,
        'rewrite' => array( 'hierarchical' => true, 'slug' => 'tripdetails' ), 
add_action( 'init', 'tripdetails_init' );

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)


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.