在我的functions.php
我有个钩子:
add_action( \'woocommerce_before_single_product\', \'display_category_list\',20 );
function display_category_list() {
wc_get_template( \'woocommerce/single-product/single-product-top-
content.php\' );
}
但我只需要在属于特定自定义分类法的产品页面上激活此挂钩。
所以我需要找出每个产品的自定义分类法。现在我有了这个代码:
$taxonomy_objects = get_object_taxonomies( \'product\', \'objects\' );
print_r( $taxonomy_objects);
这就是我得到的:
Array ( [product_category] => WP_Taxonomy Object ( [name] =>
product_category [label] => Product Categories [labels] => stdClass Object
( [name] => Product Categories [singular_name] => Product Category
[search_items] => Search Product Categories [popular_items] => [all_items]
=> All Product Categories [parent_item] => Parent Product Category
[parent_item_colon] => Parent Product Category: [edit_item] => Edit Product
Category........
这就是我需要的
http://prntscr.com/j3o06n
我该怎么做?