回答編集履歴
1
ミスがあったため修正。
answer
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
$cfcb = get_field_object( 'window' );
|
|
4
4
|
$cfcbId = get_post_meta( $post->ID, 'window' );
|
|
5
5
|
$cfcbId = $cfcbId[ 0 ];
|
|
6
|
-
if ( $cfcb && $cfcb[ 'choices' ]
|
|
6
|
+
if ( $cfcb && $cfcb[ 'choices' ] ) {
|
|
7
7
|
$bgs = []; // 無いとは思うがPHP5.3より前のバージョンならエラー。
|
|
8
8
|
$labels = [];
|
|
9
9
|
foreach( (array) $cfcb[ 'choices' ] as $value => $label ) { // チェックされていない物「-」を含め表示するなら $cfcb[ 'choices' ] の中身を確認しないといけない
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
$tmp = $label;
|
|
13
13
|
$bgs[] = 'bg-'.$value;
|
|
14
14
|
}
|
|
15
|
-
$labels[] = $
|
|
15
|
+
$labels[] = $tmp;
|
|
16
16
|
}
|
|
17
17
|
echo '<div class="'.implode( ' ', $bgs ).'">窓:'.implode( '/', $labels ).'</div>'; // 配列を文字列にして出力
|
|
18
18
|
} // 未テスト
|