Repeater 重复器
字段设置
//循环输出每行,容器为preview if( have_rows('preview') ): // Loop through rows. while( have_rows('preview') ) : the_row(); // Load sub field value. $bookname1 = get_sub_field('bookname1');//获取文章ID $bookpdf = get_sub_field('bookpdf');//获取下载地址 echo '<div class="mulu">'; echo '<div class="mulu-name">'; echo get_the_title($bookname1);//通过ID获取文章标题 echo '</div>'; echo '<div class="mulu-pdf btn">'; echo '<a href="'.$bookpdf.'" target="_blank">目錄預覽</a>'; echo '</div>'; echo '</div>'; // Do something... // End loop. endwhile; // No value. else : echo '暫時無預覽'; endif;