我已经为我的自定义帖子类型注册了一个新的分类法,现在我正在尝试编辑分类法表。
我已成功删除“说明”列,但我无法找到它how to edit column width for the column that shows the number of custom post types found 在特定的分类法中。该列的CSS类似乎是column-posts
, 因此,其宽度设置为10%
.
Shouldn\'t the column\'s CSS class be column-{my-custom-post-type}
and not the default?
Can I somehow force the column\'s width be set to auto
or set its class to match my custom-post-type?
以下是我迄今为止所做的:
Custom Post Type
function registerPersonnelPostType() {
$labels = array(
\'name\' => __( \'Personnel\', \'xxx\' ),
\'singular_name\' => __( \'Personnel\', \'xxx\' ),
\'add_new\' => __( \'Add New\', \'xxx\' ),
\'add_new_item\' => __( \'Add New Personnel Member\', \'xxx\' ),
\'edit_item\' => __( \'Edit Personnel Member\', \'xxx\' ),
\'new_item\' => __( \'New Personnel Member\', \'xxx\' ),
\'view_item\' => __( \'View Personnel Member\', \'xxx\' ),
\'search_items\' => __( \'Search Personnel\', \'xxx\' ),
\'not_found\' => __( \'No personnel found\', \'xxx\' ),
\'not_found_in_trash\' => __( \'No personnel found in Trash\', \'xxx\' ),
\'parent_item_colon\' => __( \'Parent Personnel:\', \'xxx\' ),
\'menu_name\' => __( \'Personnel\', \'xxx\' )
);
$args = array(
\'labels\' => $labels,
\'hierarchical\' => true,
\'description\' => \'Staff names and descriptions\',
\'supports\' => array( \'title\', \'editor\', \'thumbnail\' ),
\'public\' => true,
\'show_ui\' => true,
\'show_in_menu\' => true,
\'menu_position\' => 20,
\'show_in_nav_menus\' => true,
\'publicly_queryable\' => true,
\'exclude_from_search\' => false,
\'has_archive\' => true,
\'query_var\' => true,
\'can_export\' => true,
\'rewrite\' => true,
\'capability_type\' => \'post\'
);
register_post_type( \'personnel\', $args );
}
Taxonomy function departmentInit() {
$labels = array(
\'name\' => __( \'Department\', \'xxx\' ),
\'singular_name\' => __( \'Department\', \'xxx\' ),
\'search_items\' => __( \'Search Departments\', \'xxx\' ),
\'all_items\' => __( \'All Departments\', \'xxx\' ),
\'parent_item\' => __( \'Parent Department\', \'xxx\' ),
\'parent_item_colon\' => __( \'Parent Department:\', \'xxx\' ),
\'edit_item\' => __( \'Edit Department\', \'xxx\' ),
\'update_item\' => __( \'Update Department\', \'xxx\' ),
\'add_new_item\' => __( \'Add New Department\', \'xxx\' ),
\'new_item_name\' => __( \'New Department Name\', \'xxx\' ),
\'menu_name\' => __( \'Department\', \'xxx\' )
);
$args = array(
\'labels\' => $labels,
\'hierarchical\' => true,
\'show_ui\' => true,
\'query_var\' => true,
\'rewrite\' => array( \'slug\' => \'department\' )
);
register_taxonomy( \'department\' , array(\'personnel\'), $args );
}
Hooks for editing columns add_filter( \'manage_edit-department_columns\', \'departmentColumns\' );
function departmentColumns( $columns ) {
if ( isset( $columns[ \'description\' ] ) ) {
unset( $columns[ \'description\' ] );
}
return $columns;
}