Advanced Custom Fieldの追加フィールドを出力したい
-
タクソノミー : 予約状況(スラッグ名 : tour_status)
ACFで、
・フィールドグループ1 : 「予約状況」というラベルに、フィールドタイプ「タクソノミー」、タクソノミーに「予約状況」 を指定
」
・フィールドグループ2 : タクソノミー「予約状況」に、カラーピッカーフィールド(status_color)を追加という設定をしています。
このカラーピッカーフィールド(status_color)の値を、以下のソースで出力させることができず困っています。ご教示願います。
<?php // ループ if ( $the_query->have_posts() ): while ( $the_query->have_posts() ): $the_query->the_post(); ?> ~ <?php $terms = wp_get_object_terms($post->ID, 'tour_status'); // タクソノミースラッグ foreach($terms as $term){ $term_color = get_field('status_color','tour_status_'.$term_id); // 追加したカスタムフィールドの取得 echo $term_color ; // タームの値を表示 } var_dump( $terms ); ?> ~ <?php endwhile; endif; ?>
$term_color = get_field(‘status_color’,’tour_status_’.$term_id); // 追加したカスタムフィールドの取得
で取得できていないようなので、記述方法が間違っているのでしょうか。
2件の返信を表示中 - 1 - 2件目 (全2件中)
2件の返信を表示中 - 1 - 2件目 (全2件中)
- トピック「Advanced Custom Fieldの追加フィールドを出力したい」には新たに返信することはできません。