我希望能够在商店页面上的Woocommerce中为我的产品添加字幕 . 我现在把它设置为目录,因为我还没有积极销售我的产品,所以我已经禁用了添加到购物车按钮和价格 . 我想能够说明产品有多少种颜色作为副 Headers . 我已经阅读了有关使用Woocommerce添加元框的内容,并找到了这个解决方案并将其添加到我的functions.php中,但它似乎没有在我的网站上工作(我无法找到输入产品信息的位置) !)
add_filter( 'cmb_meta_boxes', 'bhww_core_cpt_metaboxes' );
function bhww_core_cpt_metaboxes( $meta_boxes ) {
//global $prefix;
$prefix = '_bhww_'; // Prefix for all fields
// Add metaboxes to the 'Product' CPT
$meta_boxes[] = array(
'id' => 'bhww_woo_tabs_metabox',
'title' => 'Additional Product Information - <strong>Optional</strong>',
'pages' => array( 'product' ), // Which post type to associate with?
'context' => 'normal',
'priority' => 'default',
'show_names' => true,
'fields' => array(
array(
'name' => __( 'Colors', 'cmb' ),
'desc' => __( 'Anything you enter here will be displayed on the Colors tab.', 'cmb' ),
'id' => $prefix . 'ingredients_wysiwyg',
'type' => 'wysiwyg',
'options' => array( 'textarea_rows' => 5, ),
),
),
);
return $meta_boxes;
}