Closed. This question is off-topic. It is not currently accepting answers.admin管理员组文章数量:1426025
Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 5 years ago.
Improve this questionI've been working on an ACF Gallery that uses the bootstrap carousel style.
I've got it to work but it seems to create an extra loop instead of closing it after the last image.
This is the code I have so far
<?php
$images = get_field('slider_portfolio');
$divider = 2;
if( $images ): ?>
<div id="mini-carousel2" class="carousel slide" data-ride="carousel">
<div class="carousel-inner" style="max-height: 250px;min-height: 250px">
<div class="carousel-item active">
<div class="row">
<?php
$total = count( $images );
$counter = 0;
foreach( $images as $image ):
$counter++; ?>
<div class="col-md-6 col-sm-12 col-xs-12">
<a href="<?php echo $image['sizes']['large']; ?>" class="fancybox img-<?php echo $counter; ?>" rel="mini" data-toggle="lightbox" data-gallery="portfolio-gallery">
<img class="img-fluid" src="<?php echo $image['sizes']['large']; ?>" alt="<?php echo $image['title']; ?>" />
</a>
</div>
<?php $current_position = $images->$image + 1;
if (/* $image < $image->$total && */ $counter % $divider == 0) : ?>
</div>
</div>
<div class="carousel-item">
<div class="row">
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
</div>
<!-- Controls -->
<a class="carousel-control-prev" href="#mini-carousel2" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span></a>
<a class="carousel-control-next" href="#mini-carousel2" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span></a></div>
<?php endif; ?>
Any help and advice would be appreciated.
Closed. This question is off-topic. It is not currently accepting answers.Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.
Closed 5 years ago.
Improve this questionI've been working on an ACF Gallery that uses the bootstrap carousel style.
I've got it to work but it seems to create an extra loop instead of closing it after the last image.
This is the code I have so far
<?php
$images = get_field('slider_portfolio');
$divider = 2;
if( $images ): ?>
<div id="mini-carousel2" class="carousel slide" data-ride="carousel">
<div class="carousel-inner" style="max-height: 250px;min-height: 250px">
<div class="carousel-item active">
<div class="row">
<?php
$total = count( $images );
$counter = 0;
foreach( $images as $image ):
$counter++; ?>
<div class="col-md-6 col-sm-12 col-xs-12">
<a href="<?php echo $image['sizes']['large']; ?>" class="fancybox img-<?php echo $counter; ?>" rel="mini" data-toggle="lightbox" data-gallery="portfolio-gallery">
<img class="img-fluid" src="<?php echo $image['sizes']['large']; ?>" alt="<?php echo $image['title']; ?>" />
</a>
</div>
<?php $current_position = $images->$image + 1;
if (/* $image < $image->$total && */ $counter % $divider == 0) : ?>
</div>
</div>
<div class="carousel-item">
<div class="row">
<?php endif; ?>
<?php endforeach; ?>
</div>
</div>
</div>
<!-- Controls -->
<a class="carousel-control-prev" href="#mini-carousel2" role="button" data-slide="prev">
<span class="carousel-control-prev-icon" aria-hidden="true"></span>
<span class="sr-only">Previous</span></a>
<a class="carousel-control-next" href="#mini-carousel2" role="button" data-slide="next">
<span class="carousel-control-next-icon" aria-hidden="true"></span>
<span class="sr-only">Next</span></a></div>
<?php endif; ?>
Any help and advice would be appreciated.
Share Improve this question edited May 23, 2019 at 8:22 Matthew asked May 23, 2019 at 7:56 MatthewMatthew 136 bronze badges1 Answer
Reset to default 1change the condition like this,
if ( ($counter % $divider == 0) && $total > $counter) : ?>
本文标签: phpACF amp Bootstrap Gallery Shows Blank Slides
版权声明:本文标题:php - ACF & Bootstrap Gallery Shows Blank Slides 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745470631a2659731.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论