Php 尝试调用引导选项卡内的特定高级自定义字段repeater字段
我有一堆缩略图,它们是通过几个高级自定义字段和重复字段加载的。单击缩略图时,我希望每个缩略图的相应文本显示在引导选项卡的内容分区中。文本与图像位于同一转发器中,但为单独的字段。但我不知道如何通过单击访问相应的转发器字段文本。缩略图的数量是无限的 缩略图列表使用以下代码:Php 尝试调用引导选项卡内的特定高级自定义字段repeater字段,php,wordpress,repeater,advanced-custom-fields,Php,Wordpress,Repeater,Advanced Custom Fields,我有一堆缩略图,它们是通过几个高级自定义字段和重复字段加载的。单击缩略图时,我希望每个缩略图的相应文本显示在引导选项卡的内容分区中。文本与图像位于同一转发器中,但为单独的字段。但我不知道如何通过单击访问相应的转发器字段文本。缩略图的数量是无限的 缩略图列表使用以下代码: <ul> <?php foreach (get_field('repeater-field', 39) as $row) :?> <li><
<ul>
<?php foreach (get_field('repeater-field', 39) as $row) :?>
<li><a href="#profile" data-toggle="tab"> <img class="img-responsive img-rounded img-ref" src="<?php print $row['image'] ?>"/> </a> </li>
<?php endforeach; ?>
</ul>
到目前为止,这是我对选项卡内容的了解,但它只显示第一个repeater字段,而不是每个缩略图的文本:
<div class="tab-content">
<div class="tab-pane active" id="home"></div>
<div class="tab-pane" id="profile">
<?php
$rows = get_field('repeater-field', 39);
echo $rows[0]['text'];
?>
</div>
</div>
我自己设法解决了这个问题。但由于某种原因,引导衰减效果消失了 将此用于缩略图:
-
对于选项卡,请执行以下操作:
<ul class="tabs">
<?php
$i = 1;
while( have_rows('my_field', 39) ): the_row();
// vars
$image = get_sub_field('thumb');
?>
<li class="tab-list">
<a href="#<?php echo $i; ?>" data-toggle="tab">
<img class="img-responsive img-rounded img-ref" src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt'] ?>" />
</a>
</li>
<?php
$i++;
endwhile;
?>
</ul>
<?php endif; ?>
<div class="tab-content">
<div class="tab-pane fade in " id="home"></div>
<?php
$i = 1;
while( have_rows('my_field', 39) ): the_row();
// vars
$text = get_sub_field('my_text');
?>
<div class="tab-pane fade" id="<?php echo $i; ?>">
<?php echo $text; ?>
</div>
<?php
$i++;
endwhile;
?>
</div>
<?php endif; ?>