我需要添加一个图像上传字段到我的自定义帖子类型。但它应该在分类法(产品类别)内。如何添加该字段?。
<?php
add_action(\'init\', \'wlg_cstm_register\');
function wlg_cstm_register() {
$product_labels = array(
\'name\' => _x(\'Products\', \'post type general name\'),
\'singular_name\' => _x(\'Product\', \'post type singular name\'),
\'add_new\' => _x(\'Add New\', \'Product\'),
\'add_new_item\' => __(\'Add New Product\'),
\'edit_item\' => __(\'Edit Product\'),
\'new_item\' => __(\'New Product\'),
\'view_item\' => __(\'View Products\'),
\'search_items\' => __(\'Search Products\'),
\'not_found\' => __(\'No Products found\'),
\'not_found_in_trash\' => __(\'No Products found in Trash\'),
\'parent_item_colon\' => \'\'
);
$product_args = array(
\'labels\' => $product_labels,
\'public\' => true,
\'show_ui\' => true,
\'capability_type\' => \'post\',
\'hierarchical\' => false,
\'rewrite\' => true,
\'supports\' => array(\'title\', \'editor\', \'thumbnail\'),
\'taxonomies\' => array( \'\' ),
\'menu_icon\' => get_bloginfo(\'template_directory\') . \'/resources/img/Products-icon.png\', // Icon Path
\'has_archive\' => false
);
register_post_type( \'products\' , $product_args );
register_taxonomy( \'item\', \'products\', array( \'hierarchical\' => true, \'label\' => __(\'Product Category\'), \'query_var\' => \'item\' ) );
}