Hi,
i used:
<?php $images = get_sub_field('portfolio_referenz_galerie_content');
if( $images ): ?>
<?php
for($i=1; $i<count($images) && $i<100; $i++) {
$image = $images[$i];
?>
<img src="<?php echo $image['url']; ?>" alt="" class="carousel-cell-img " />
<?php
}
?>
I fixed it, sorry. This worked for me:
<?php if( have_rows('commissioned-overview_content', 'option') ): ?>
<?php while( have_rows('commissioned-overview_content', 'option') ): the_row(); ?>
<?php the_sub_field('commissioned-overview_content_link'); ?>
<?php endwhile; ?>
<?php endif; ?>
Hi, can anyone please help me on this? I need to skip the first image, because I need to display it outside of the foreach. Ty
Hello,
I can not get this working within a repeater field. Any idea, thanks! This is my code:
...
<?php elseif(get_row_layout() == "portfolio_referenz_galerie"): ?>
<div class="carousel-container">
<div id="carousel-<?php the_sub_field('galerie_id'); ?>" class="carousel" data-flickity='{ "imagesLoaded": true, "setGallerySize": false, "lazyLoad": true }'>
<?php
$placeholder = get_sub_field('portfolio_referenz_galerie_content');
$placeholder_1 = $placeholder[0];
?>
<img src="<?php echo $placeholder_1['url']; ?>" alt="" id="carousel-cell-img-<?php the_sub_field('galerie_id'); ?>" class="carousel-cell-img placeholder" />
<?php
$images = get_sub_field('portfolio_referenz_galerie_content');
if( count($images) > 1 ):
$count = 0;
?>
<?php foreach( $images as $image ):
if ($count == 0) {
// skip the first one
continue;
}
$count++;
?>
<img src="placeholder-2500-1406.png" data-flickity-lazyload="<?php echo $image['url']; ?>" alt="" id="carousel-cell-img-<?php the_sub_field('galerie_id'); ?>" class="carousel-cell-img" />
<?php endforeach; ?>
<?php endif; ?>
</div>
...
Thank you! I had to group ifelse-loops for pages, group them for posts and group them for custom content, it worked.
post type equals page
page unequal index
page unuequl news
post type equals events
etc. etc.
Stupid me 🙂
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.