0
所以我使用ACF(高級自定義字段),我想顯示前四行。雖然我在所有20行,我只需要在第一個五年行或最後5行如何使用PHP在前4行顯示字段?
而且,我的代碼並不需要在一個循環中顯示的字段,所以我願意接受任何答案。我只把我的代碼放在一個循環中,因爲這是我知道如何顯示中繼器子字段的唯一方法。我非常新的使用領域ACF
<?php
// check if the repeater field has rows of data
if(have_rows('repeat_field')):
// loop through the rows of data
while (have_rows('repeat_field')) : the_row();
// display a sub field value
the_sub_field('place_name');
the_sub_field('place_date');
the_sub_field('place_time');
endwhile;
else :
// no rows found
endif;