I’ve sucessefuly add a second taxonomy known as tagcat” to a customized put up kind known as “data”,
add_action ('init','create_information_eventcat_taxonomy','0');
perform create_information_eventcat_taxonomy () {
$taxonomylabels = array(
'title' => _x('カテゴリー','put up kind common title'),
'singular_name' => _x('カテゴリー','put up kind singular title'),
'search_items' => __('カテゴリー'),
'all_items' => __('informationカテゴリー'),
'parent_item' => __( 'Mother or father Cat' ),
'parent_item_colon' => __( 'Mother or father Cat:' ),
'edit_item' => __('informationカテゴリーを編集'),
'add_new_item' => __('informationカテゴリーを書く'),
'menu_name' => __( 'informationカテゴリー' ),
);
$args = array(
'labels' => $taxonomylabels,
'hierarchical' => true,
'has_archive' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'informationcat' )
);
register_taxonomy('informationcat','data',$args);
}
// Rewrite Customized Taxonomy to share base slug with Customized Publish Kind
perform rewrite_information_event_category() {
$information_event_category_args = get_taxonomy( 'informationcat' ); // returns an object
$information_event_category_args->show_admin_information_event = true;
$information_event_category_args->rewrite['slug'] = 'data';
$information_event_category_args->rewrite['with_front'] = false;
register_taxonomy( 'informationcat', 'data', (array) $information_event_category_args );
}
add_action( 'init', 'rewrite_information_event_category', 11 );
add_action ('init','create_tagcat_taxonomy','0');
perform create_tagcat_taxonomy () {
$taxonomylabels = array(
'title' => _x('タグ','put up kind common title'),
'singular_name' => _x('タグ','put up kind singular title'),
'search_items' => __('タグ'),
'all_items' => __('タグ'),
'parent_item' => __( 'Mother or father Cat' ),
'parent_item_colon' => __( 'Mother or father Cat:' ),
'edit_item' => __('タグを編集'),
'add_new_item' => __('タグを書く'),
'menu_name' => __( 'タグ' ),
);
$args = array(
'labels' => $taxonomylabels,
'hierarchical' => true,
'has_archive' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'tagcat' )
);
register_taxonomy('tagcat','data',$args);
}
// Rewrite Customized Taxonomy to share base slug with Customized Publish Kind
perform rewrite_list_category() {
$list_category_args = get_taxonomy( 'tagcat' ); // returns an object
$list_category_args->show_admin_list = true;
$list_category_args->rewrite['slug'] = 'data';
$list_category_args->rewrite['with_front'] = false;
register_taxonomy( 'tagcat', 'data', (array) $list_category_args );
}
add_action( 'init', 'rewrite_list_category', 11 );
Im having issues coping with two taxonomies, within the permalinks.
How can I show, the 2 taxonomies, in two separated taxonomie pages?Its presently solely displaying the taxonomie-tagcat.php, however taxonomie-informmationcat.php is returning 404. I suppose it has to do with information_rewrites_init(), what ought to I do?
perform information_rewrites_init($post_link, $put up = 0){
add_rewrite_rule('data/([0-9]+)?(web page/)?([0-9]+)?/?$', 'index.php?paged=$matches[3]&post_type=data&p=$matches[1]', 'prime');
add_rewrite_rule('data/([A-Za-z0-9-_]+)/?(web page/)?([0-9]+)?/?$', 'index.php?paged=$matches[3]&informationcat=$matches[1]', 'prime');
add_rewrite_rule('data/([A-Za-z0-9-_]+)/?(web page/)?([0-9]+)?/?$', 'index.php?paged=$matches[3]&tagcat=$matches[1]', 'prime');
}
add_action('init', 'information_rewrites_init');