我已通过以下代码创建了自定义分类法。但是我需要分类法是一个单选按钮,而不是复选框。我给用户的目标是一次可以选择一个分类法。
//hook into the init action and call create_book_taxonomies when it fires
add_action( 'init', 'create_type_player_taxonomy', 0 );
//create a custom taxonomy name it Type for your posts
function create_type_player_taxonomy() {
// Add new taxonomy, make it hierarchical like categories
//first do the translations part for GUI
$labels = array(
'name' => _x( 'Types', 'taxonomy general name' ),
'singular_name' => _x( 'Type', 'taxonomy singular name' ),
'search_items' => __( 'Search Type' ),
'all_items' => __( 'All Type' ),
'parent_item' => __( 'Parent Type' ),
'parent_item_colon' => __( 'Parent Type:' ),
'edit_item' => __( 'Edit Type' ),
'update_item' => __( 'Update Type' ),
'add_new_item' => __( 'Add New Type' ),
'new_item_name' => __( 'New Type Name' ),
'menu_name' => __( 'Type' ),
);
// Now register the taxonomy
register_taxonomy('Type',array('players'), array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'type' ),
));
}
有没有办法通过单选按钮获取自定义分类法。