Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 显示电子商务标签_Php_Wordpress_Woocommerce - Fatal编程技术网

Php 显示电子商务标签

Php 显示电子商务标签,php,wordpress,woocommerce,Php,Wordpress,Woocommerce,如何使用WooCommerce 2.1.8版在单一产品页面的底部显示相关的标签,而不是相关的类别?我会在单一产品挂钩之后使用WooCommerce。然后使用get_the_tags() 主题的functions.php中有类似的内容: add_action('woocommerce_after_single_product', 'add_tags_to_product'); function add_tags_to_product() { $posttags = get_the_tags()

如何使用WooCommerce 2.1.8版在单一产品页面的底部显示相关的标签,而不是相关的类别?

我会在单一产品挂钩之后使用WooCommerce。然后使用get_the_tags()

主题的functions.php中有类似的内容:

add_action('woocommerce_after_single_product', 'add_tags_to_product');
function add_tags_to_product() {
  $posttags = get_the_tags();
  if ($posttags) {
    foreach($posttags as $tag) {
      echo $tag->name . ' '; 
    }
  }
}