Support

Account

Home Forums Add-ons Repeater Field All images from repeater

Helping

All images from repeater

  • Hello. I made a slider with tabs, in each taba I have a repeater cycle, I want to display in a separate taba all the images that the repeater created in the tabs. How can I do that?

    `Here my code
    <div class=”photo-container”>
    <div class=”toggle”>
    <div class=’tabs’>
    <?php if( have_rows(‘create_tab’) ): ?>
    <div class=’tab’>All</div>
    <?php while( have_rows(‘create_tab’) ): the_row();
    $tab_name = get_sub_field(‘tab_name’); ?>
    <div class=’tab’><?php echo $tab_name; ?> </div>
    <?php endwhile; ?>
    <?php endif; ?>
    </div>
    <div class=’panels’>
    <?php if( have_rows(‘create_tab’) ): ?>
    <?php while( have_rows(‘create_tab’) ): the_row(); ?>

    <div class=’slide-container’>
    <div class=’panel multiple-items’>
    <?php if( have_rows(‘photo_slider’) ): ?>
    <?php while( have_rows(‘photo_slider’) ): the_row();
    $slide_photo = get_sub_field(‘add_photo’); ?>
    ” alt=”<?php echo $slide_photo[‘alt’]; ?>” />
    <?php endwhile; ?>
    <?php endif; ?>
    </div>
    </div>
    <?php endwhile; ?>
    <?php endif; ?>
    </div>
    </div>
    </div>

  • Hi @alekspvn

    I’m not sure I am 100% clear on what is being asked, but I am going to do my best to help. I may need more clarification.

    The Image field can return an Array, a URL, or an ID for each image, so it largely depends on which choice you made as the Return Value how you write the code.

    Since Array is the default return value, I will show code for that below:

    I am guessing you need help with the code between the ‘div’ with the ‘panel’ and ‘multiple-items’ classes, so here goes…

    
    <?php
    if ( have_rows('photo_slider') ) {
      while ( have_rows('photo_slider') ) {
        the_row();
        $slide_photo = get_sub_field('add_photo');
        if ( !empty($slide_photo) ) {
    ?>
    <img src="<?php echo $slide_photo['url']; ?>" alt="<?php echo $slide_photo['alt']; ?>" />
    <?php
        }
      }
    }
    ?>
    

    Is that what you are looking to achieve? I will get an email alert with your reply, and will help further if need be!

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

The topic ‘All images from repeater’ is closed to new replies.