Wordpress 带ACF的引导选项卡
我想将ACF应用于客户端项目的引导选项卡。我可以实现这个目标。。。但唯一的问题是,它使用的是BS4,我想将其应用于v5。我从我研究过的网站上获得了代码(如果需要,我可以提供)Wordpress 带ACF的引导选项卡,wordpress,bootstrap-4,advanced-custom-fields,bootstrap-5,acfpro,Wordpress,Bootstrap 4,Advanced Custom Fields,Bootstrap 5,Acfpro,我想将ACF应用于客户端项目的引导选项卡。我可以实现这个目标。。。但唯一的问题是,它使用的是BS4,我想将其应用于v5。我从我研究过的网站上获得了代码(如果需要,我可以提供) (我已经有一段时间没有在这里发布问题了,只是忘记了如何发布代码,抱歉。但我希望这是有意义的?) <?php // *Repeater // tabs_repeater // *Sub-Fields // tab_header // tab_content // check if the repea
(我已经有一段时间没有在这里发布问题了,只是忘记了如何发布代码,抱歉。但我希望这是有意义的?)
<?php
// *Repeater
// tabs_repeater
// *Sub-Fields
// tab_header
// tab_content
// check if the repeater field has rows of data
if( have_rows('tabs_repeater') ):
$i = 1; // Set the increment variable
echo '<ul class="nav nav-tabs" id="myTab" role="tablist">';
// loop through the rows of data for the tab header
while ( have_rows('tabs_repeater') ) : the_row();
$header = get_sub_field('tab_header');
$content = get_sub_field('tab_content');
?>
<li class="nav-item">
<a class="nav-link <?php if($i == 1) echo 'active';?>" id="<?php echo sanitize_title($header); ?>-tab" data-toggle="tab" href="#<?php echo sanitize_title($header); ?>" role="tab" aria-controls="<?php echo sanitize_title($header); ?>" aria-selected="true"><?php echo $header; ?></a>
</li>
<?php $i++; // Increment the increment variable
endwhile; //End the loop
echo '</ul>
<div class="tab-content" id="myTabContent">';
$i = 1; // Set the increment variable
// loop through the rows of data for the tab content
while ( have_rows('tabs_repeater') ) : the_row();
$header = get_sub_field('tab_header');
$content = get_sub_field('tab_content');
?>
<div class="tab-pane fade show <?php if($i == 1) echo 'active';?>" id="<?php echo sanitize_title($header); ?>" role="tabpanel" aria-labelledby="<?php echo sanitize_title($header); ?>-tab"><?php echo $content; ?></div>
<?php $i++; // Increment the increment variable
endwhile; //End the loop
echo '</div>';
else :
// no rows found
endif;
?>