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;?>
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.