我想用这个片段来替换产品的标题。这样可行。
/** Remove the shop loop title link and replace with brand **/
remove_action( 'woocommerce_shop_loop_item_title','woocommerce_template_loop_product_title', 10 );
add_action('woocommerce_shop_loop_item_title', 'abChangeProductsTitle', 10 );
function abChangeProductsTitle() { ?>
<p class="name product-title custom-brand" style="height: 23px;">
<?php echo strip_tags ( get_the_term_list( $post->ID, 'product_brand', '', ', ', '' ) ); ?>
</p><?php
}
Run Code Online (Sandbox Code Playgroud)
但我试图弄清楚如果产品类型不是捆绑产品(来自https://woocommerce.com/products/product-bundles/ ),如何仅运行此代码片段(替换所有其他产品上的标题) 。
有人可以帮我一点吗?
php wordpress product woocommerce woocommerce-product-bundles