Support

Account

Home Forums General Issues Don't getting sub_fields since update

Helping

Don't getting sub_fields since update

  • Hi!
    I’ve updated a ACF Pro for a client and since then a repeater field is not working. The code is not mine but seems ok here it is:

    
    <?php if(get_field('index_banner_carrossel', 'option')): ?>
                	<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
                        <div class="carousel-inner">
                        	<?php $count=0; ?>
                            <pre><?php var_dump(get_field('index_banner_carrossel', 'option'));?></pre>
    						<?php while(has_sub_field('index_banner_carrossel', 'option')): ?>
    						<div class="item <?php if ($count == 0) echo 'active' ; ?>">
    							<a href="<?php the_sub_field('index_carousel_link'); ?>">
    								<img id="img-noresize" class="img-noresize" src="<?php the_sub_field('index_carousel_imagem'); ?>" alt="...">
    							</a>
    							<div class="carousel-caption">
    								<h3 class="carousel-title"><?php the_sub_field('index_carousel_titulo'); ?></h3>
    								<p class="carousel-desc"><?php the_sub_field('index_carousel_descricao'); ?></p>
    							</div>
    						</div>
    						<?php $count++; ?>
    						<?php endwhile; ?>
                        </div>
                        <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
                            <span class="glyphicon glyphicon-chevron-left"></span>
                        </a>
                        <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
                            <span class="glyphicon glyphicon-chevron-right"></span>
                        </a>
                    </div>
                    <?php endif; ?>
    

    I’ve found out that has_sub_field(‘index_banner_carrossel’, ‘option’) is returning false, but get_field(‘index_banner_carrossel’, ‘option’) is returning 2
    We have 2 rows of subfields so it should be have soemthing there :/

    Anyone can help me?

    Thanks in advance

  • try to replace this line:
    <?php while(has_sub_field('index_banner_carrossel', 'option')): ?>
    with this
    <?php while( have_rows('index_banner_carrossel', 'option') ): the_row(); ?>

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Don't getting sub_fields since update’ is closed to new replies.