[英]Changing woocommerce related products text with tags
I'm currently using Change Related Products Heading adding the product name in WooCommerce answer code but instead of the get_the_title I want to be getting the tags of the product我目前正在使用更改相关产品标题在 WooCommerce 答案代码中添加产品名称,而不是 get_the_title 我想获取产品的标签
$term_list = array();
$terms_data = wp_get_post_terms( get_the_id(), 'product_tag' );
if( count($terms_data) > 0 ){
foreach($terms_data as $termdata){
$term_id = $termdata->term_id;
$term_name = $termdata->name;
$term_slug = $termdata->slug;
$term_link = get_term_link( $termdata, 'product_tag' );
$term_list[] = '<a href="'.$term_link.'">'.$term_name.'</a>';
}
$term_list = implode( ', ', $output );
echo $term_list;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.