显示product_category标签在档案页面中的产品标题上方
我有一家卖图片的商店。
每张图片都是由其艺术家进行了分类的。
我希望艺术家名称(子类别)在产品标题上方显示。
以下代码针对我想要的地方:
add_action( 'woocommerce_shop_loop_item_title','add_artist_name', 9);
function add_artist_name() {
echo 'artiste name';
}
add_action( 'woocommerce_shop_loop_item_title','add_artist_name', 9);
function add_artist_name() {
echo wc_get_product_category_list( $product->get_id(), ', ', '<span class="posted_in">' . _n( 'Category:', 'Categories:', count( $product->get_category_ids() ), 'woocommerce' ) . ' ', '</span>' );
}
您能告诉我为什么添加该行不起作用,解决方案是什么?
此外,我只想显示子类别。
和往常一样,非常感谢。
I have a shop that sells pictures.
Each picture is sub-categorized by its artist.
I want the artist name (sub-category) to display above the product title.
The following code targets the place I want it to be :
add_action( 'woocommerce_shop_loop_item_title','add_artist_name', 9);
function add_artist_name() {
echo 'artiste name';
}
I tried to duplicate the code that runs the category name on the single product page but it doesn't work and add bugs along the way.
add_action( 'woocommerce_shop_loop_item_title','add_artist_name', 9);
function add_artist_name() {
echo wc_get_product_category_list( $product->get_id(), ', ', '<span class="posted_in">' . _n( 'Category:', 'Categories:', count( $product->get_category_ids() ), 'woocommerce' ) . ' ', '</span>' );
}
Can you tell me why adding that line doesn't work and what is the fix ?
Furthermore, I would like only the subcategory to display.
As always, many thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论