ACF选择字段返回值为“ Array”

时间:2019-05-22 09:51:59

标签: php wordpress advanced-custom-fields

我正在建立一个使用WordPress中大量高级自定义字段的网页。使用一个选择字段,该字段在前端输出单词“ Array”。我尝试使用多个值,而不只是一个,但仍然相同!

其他所有功能都可以正常运行。代码如下(所讨论的字段为echo get_sub_field('type'))。

<?php
    if( have_rows('service') ):
    while( have_rows('service') ) : the_row();
        $message1 = get_sub_field('upcoming_change');
    endwhile;
endif;
if($message1=="yes"){
if( have_rows('service') ):
    while( have_rows('service') ) : the_row();
echo'<table class="status-table">';
  echo'<tr>';
    echo'<th>';echo"Change Number";echo'</th>';
    echo'<th>';echo"Type";echo'</th>';
    echo'<th>';echo"Impact Statement";echo'</th>';
    echo'<th>';echo"Risk Statement";echo'</th>';
    echo'<th>';echo"Start";echo'</th>';
    echo'<th>';echo"End";echo'</th>';
  echo'</tr>';
  echo'<tr>';
    echo'<td>';echo get_sub_field('change_number');echo'</td>';
    echo'<td>';echo get_sub_field('type');echo'</td>';
    echo'<td>';echo get_sub_field('impact_statement');echo'</td>';
    echo'<td>';echo get_sub_field('risk_statement');echo'</td>';
    echo'<td>';echo get_sub_field('start');echo'</td>';
    echo'<td>';echo get_sub_field('end');echo'</td>';
  echo'</tr>';
echo'</table>';
    endwhile;
endif;
}?>

0 个答案:

没有答案