如何在我的wp插件中使用wooCommerce挂钩?以下是我想做的:
add_filter(\'woocommerce_edit_product_columns\', \'pA_manage_posts_columns\');
function pA_manage_posts_columns($columns, $post_type = \'product\') {
global $woocommerce;
if ( in_array( $post_type, array( \'product\') ) ) {
$columns[\'offering_price\'] = __( \'offering price\', \'your_text_domain\' ); // this offering price title
$columns[\'offering_qty\'] = __( \'Qty\', \'your_text_domain\' ); // add the quantity title
}
unset($columns[\'name\']);
return $columns;
}
我已经加入了woocommerce课程:
$ds = DIRECTORY_SEPARATOR;
$base_dir = realpath(dirname(__FILE__) . $ds . \'..\') . $ds;
$file = "{$base_dir}woocommerce{$ds}woocommerce.php";
include_once($file);