Support

Account

Home Forums General Issues Relationship fields within repeater fields Reply To: Relationship fields within repeater fields

  • I worked it all out. Here is my solution.

    <?php if ( get_field('primary_and_secondary_selector') ) : ?>
     
    	<?php while ( has_sub_field('primary_and_secondary_selector') ) : ?>
    	
    	<div class="grid_3">
    	
    		<?php $primary_queries = get_sub_field('primary'); ?>
    		<?php if ( $primary_queries ) : ?>
    		
    			<?php foreach( $primary_queries as $primary_query ) : ?>
     
    				<?php echo wp_get_attachment_image(get_field('supplementary_logo', $primary_query->ID), 'medium' ); ?>
     
    			<?php endforeach; ?>
    			
    		<?php wp_reset_postdata(); ?>
    		<?php endif;?>
    		
    		<?php $secondary_queries = get_sub_field('secondary'); ?>
    		<?php if ( $secondary_queries ) : ?>
    		<ul>
    		<?php foreach( $secondary_queries as $secondary_query ) : ?>
     
    			<li><?php echo wp_get_attachment_image(get_field('supplementary_logo', $secondary_query->ID), 'medium' ); ?></li>
     
    		<?php endforeach; ?>
    		</ul>
    			
    		<?php wp_reset_postdata(); ?>
    		<?php endif;?>
    		
    		</div>
     
    	<?php endwhile; ?>
    
    	<?php endif;?>