Support

Account

Home Forums Add-ons Repeater Field Load a sub field value of a Repeater field outside the loop

Unread

Load a sub field value of a Repeater field outside the loop

    • Ela

    • January 7, 2021 at 2:40 am

    I have a custom template that displays a portfolio using grids. When clicked, each grid item reveals more details in a fullscreen. To achieve this I’m using a repeater field, code bellow. Nothing wrong with the code, it work perfectly fine. Now, I need to display/load the sub field drawing_button outside the loop, but on the same fullscreen. I’ve tried every solution out there, with no avail. Instead of displaying the value related to each grid item, it displays all the values for all grid items on all fullscreen reveals.
    Any help would be very much appreciated, thank you!

    
    <div class="fullview">			
    
                    <?php if( have_rows('fullview_drawing') ): ?>
                    
                        <?php while( have_rows('fullview_drawing') ): the_row(); ?>
    
    			        <div class="fullview__item" style="background-image: url(<?php the_sub_field( 'fullview_image' ); ?>);">
    			            <div class="fullview__item-image">     
    				            <?php if( get_sub_field('fullview_image') ): ?>
    					            <img class="fullview__item-image" src="<?php the_sub_field( 'fullview_image' ); ?>" />
    				            <?php endif; ?>
    			            </div>
    				        <div class="fullview__item-titlewrap" id="fullview__item-titlewrap">
    				            <div class="fullview__item-title-cotainer">
                                    <h3 class="fullview__item-title"><?php the_sub_field( 'fullview_title' ); ?></h3>
    					            <div class="fullview__item-description"><?php the_sub_field( 'drawing_description' ); ?></div>
    					            <span class="fullview__item-more"><?php the_sub_field( 'drawing_button' ); ?></span>
    					        </div>
    				        </div>
    			        </div>
    
                        <?php endwhile; ?>
    
                    <?php endif; ?>
                    
                    <h3 class="fullview__title"><?php the_field('gallery_title'); ?></h3>
    
                </div>
    

    Here is a screenshot:

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.