Repeater

原文:https://www.advancedcustomfields.com/resources/repeater/


//循环

if( have_rows('preview') ):

// Loop through rows.
while( have_rows('preview') ) : the_row();

// Load sub field value.
$bookname1 = get_sub_field('bookname1');
$bookpdf = get_sub_field('bookpdf');
echo '<div class="mulu">';
echo '<div class="mulu-name">';
echo get_the_title($bookname1);
echo '</div>';
echo '<div class="mulu-pdf">';
echo '<a href="'.$bookpdf.'">目錄預覽</a>';
echo '</div>';
echo '</div>';
// Do something...

// End loop.
endwhile;

// No value.
else :

endif;

返回列表