1

我正在使用 woocommerce 主题。创建了一些具有自定义属性 Qun的产品

我想在产品图片下方的目录页面上显示Qun 。

 is there any solution for that? have a look at the attached image.

 i want to display that custom attribute on category page.

在此处输入图像描述

4

2 回答 2

1

你可以像这样使用while循环

if (have_posts()) {
  while (have_posts()) {
  the_post();
  $key_1_values = get_post_meta( $post->ID, 'Qun' );

   // check if the custom field has a value
  if( ! empty( $key_1_value ) ) {
     echo $key_1_value;
   } 

  }
}
于 2013-08-08T05:02:57.723 回答
0

尝试这个

$result = array_shift(woocommerce_get_product_terms($product->id, 'attr/cate_name', 'names'));
于 2013-08-08T05:54:04.183 回答