我在使用 ACF 方面还很陌生,所以我使用了他们网站中显示的代码来显示我的转发器字段内的内容。
但是,当我尝试显示转发器的内容时,它是空的??这是我的代码,它仍处于试用模式,只是为了看看它是否有效 - 事实并非如此。我的转发器字段已经有 2 行,但它没有显示其中任何一行,只显示其他:
// check if the repeater field has rows of data
if( have_rows('map_infogrp') ):
// loop through the rows of data
while ( have_rows('map_infogrp') ) : the_row();
// display a sub field value
the_sub_field('google_map');
the_sub_field('branch_name');
//$street = get_sub_field('street');
//$district = get_sub_field('district');
//$phonenum = get_sub_field('phone_number');
//$email = get_sub_field('email');
endwhile;
else:
echo 'why is this empty???';
endif;
Run Code Online (Sandbox Code Playgroud)