使用单选按钮创建自定义分类法

问题描述

我已通过以下代码创建了自定义分类法。但是我需要分类法是一个单选按钮,而不是复选框。我给用户的目标是一次可以选择一个分类法。

//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' ),));
 
}

有没有办法通过单选按钮获取自定义分类法。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)