This question is probably asked before but my language not being natively english i cant really find the answer:
I got a custom post type: products and custom (hierarchy) taxonomy: collection
in the taxonomy i got for axample: - paintings (parent tax) -- classic (sub tax) -- modern (sub tax)
now i want to reach my products via: collection/paintings/classic/classic-painting-1 but i have two problems:
Problem 1: sub tax doesn't have the parent tax in the url: collection/paintings/ and then collection/classic/.. it should collection/paintings/classic/
Problem 2: if i choose a product (eg. classic-painting-1) in collection/paintings/ it goes to products/classic-painting-1 in stead of collection/paintings/classic/classic-painting-1
i hope this big question has a simple answer, thank in advance
my codes for custom post type and taxonomy:
// Custom post type
add_action('init', 'cptui_register_my_cpt_producten');
function cptui_register_my_cpt_producten() {
register_post_type('producten', array(
'label' => 'Producten',
'description' => '',
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'capability_type' => 'post',
'map_meta_cap' => true,
'hierarchical' => true,
'rewrite' => array('slug' => 'producten', 'with_front' => true),
'query_var' => true,
'menu_position' => '1',
'supports' => array('title','editor'),
'taxonomies' => array('category','post_tag','collectie'),
'labels' => array (
'name' => 'Producten','singular_name' => 'Product','menu_name' => 'Producten','add_new' => 'Add Product','add_new_item' => 'Add New Product','edit' => 'Edit','edit_item' => 'Edit Product','new_item' => 'New Product','view' => 'View Product','view_item' => 'View Product','search_items' => 'Search Producten','not_found' => 'No Producten Found','not_found_in_trash' => 'No Producten Found in Trash','parent' => 'Parent Product',
)
) ); }
// Custom taxonomy
add_action('init', 'cptui_register_my_taxes_collectie');
function cptui_register_my_taxes_collectie() {
register_taxonomy( 'collectie',array (
0 => 'producten',
),
array( 'hierarchical' => true,
'label' => 'Collecties',
'show_ui' => true,
'query_var' => true,
'show_admin_column' => false,
'labels' => array (
'search_items' => 'Collectie',
'popular_items' => '',
'all_items' => '',
'parent_item' => '',
'parent_item_colon' => '',
'edit_item' => '',
'update_item' => '',
'add_new_item' => '',
'new_item_name' => '',
'separate_items_with_commas' => '',
'add_or_remove_items' => '',
'choose_from_most_used' => '',
)
) );
}