Support

Account

Home Forums ACF PRO Repeater with Post Object not returning expected results. Reply To: Repeater with Post Object not returning expected results.

  • Got it working with this. Hope it helps someone.

    <?php if ( have_rows( 'profile') ) : ?>
              <div class="container px-5 mx-auto flex flex-wrap">
                <div class="flex flex-wrap -m-4">
    	       <?php while ( have_rows( 'profile' )) : the_row(); ?>
               <?php $profile_link = get_sub_field( 'profile_link' );?>
                <?php if ( $profile_link ) :
                  $permalink = get_permalink( $profile_link->ID );
                  $title = get_the_title( $profile_link->ID );
                  $creds = get_field( 'creds', $profile_link->ID );
                  $headshot_id = get_field( 'headshot', $profile_link->ID ); // Profile headshot media id
                  ?>
                    <div class="row w-48 mr-8" >
                    <?php echo wp_get_attachment_image( $headshot_id, 'thumbnail', '', ["class" => "twn-profile-pic mx-auto"] );?>
                    <p class='text-sm is-all-caps text-center mt-4'><?php echo $title; ?></p>
                      </div>
                      <?php wp_reset_postdata(); ?>
                      <?php endif; ?>
    	       <?php endwhile; ?>
             </div>
             </div>
                <?php else : ?>
    	                <?php // no rows found ?>
              <?php endif; ?>