我正在使用 Category and Taxonomy Meta Fields插件在product categories.當試圖在 php 中顯示此信息時,它沒有出現。$cate = get_queried_object();$cateID = $cate->term_id;if (function_exists('get_all_wp_terms_meta')){ print_r( get_all_wp_terms_meta($cateID) );}在頁面中archive-product.php,返回Array ( )
1 回答

夢里花落0921
TA貢獻1772條經驗 獲得超6個贊
使用插件高級自定義字段
在文件中archive-product.php
使用:
$cateID?=?get_queried_object(); $return?=?get_field('NameField',?$cateID);
如果使用靈活字段,請在字段設置中命名布局并使用
if ( have_rows( 'NameItem', $cateID ) ) :
? ? while ( have_rows( 'NameItem', $cateID ) ) : the_row();
? ? ? ? if( get_row_layout() == 'NameLayout' ):
? ? ? ? ? ? echo get_sub_field('NameFiel');
? ? ? ? ?endif;
? ? endwhile;
else :
- 1 回答
- 0 關注
- 108 瀏覽
添加回答
舉報
0/150
提交
取消