I'm developing a fairly complex portfolio WP theme and I can't seem to figure out the logical and most efficient way to setup hierarchy for content. The content needs a deep hierarchy and I need breadcrumbs and menus to work. The custom post type(CPT) is used for "client work" which ideally would be a sub-page of Work >> Clients >> Client (CPT) in the default Pages structure. But I can't define a Parent page for CPT's. I'm rewriting the slug accordingly but this doesn't seem to maintain the parent/child relationship.
Currently, I have things structured like this:
Work > Clients >> Client >>> Client Work(CPT) >>> Single Work Item
My questions are: 1. Is there a better way to structure this? 2. Should I not use CPT's or how can a I add CPT's into more of a hierarchical structure so they relate to their respective parents?
Here is my CPT registration code:
class cpt_client_work {
function cpt_client_work() {
add_action('init',array($this,'create_post_type'));
}
function create_post_type() {
$labels = array(
'name' => 'Client Work',
'singular_name' => 'Client',
'add_new' => 'New Client Work',
'all_items' => 'All Client Work',
'add_new_item' => 'New Client Work',
'edit_item' => 'Edit Client Work',
'new_item' => 'New Client Work',
'view_item' => 'View Client Work',
'search_items' => 'Search Client Work',
'not_found' => 'No Client Work found',
'not_found_in_trash' => 'No Client Work found in trash',
'parent_item_colon' => 'Parent Client:',
'parent' => 'Client',
'menu_name' => 'Client Work'
);
$args = array(
'labels' => $labels,
'description' => "Client Work",
'public' => true,
'exclude_from_search' => false,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_nav_menus' => true,
'show_in_menu' => true,
'show_in_admin_bar' => true,
'menu_position' => 20,
'menu_icon' => get_bloginfo('template_directory') . '/_/images/admin-icon.png',
'capability_type' => 'post',
'hierarchical' => true,
'rewrite' => array('slug' => 'work/client'),
'supports' => array('page-attributes','title','editor','thumbnail','excerpt','custom-fields','revisions','author'),
'has_archive' => true,
'query_var' => true,
'can_export' => true
);
register_post_type('cpt_client_work',$args);
}
}