Skip to content

Instantly share code, notes, and snippets.

@nfsarmento
Created April 26, 2017 09:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nfsarmento/e636eca3ae103f6b7a99f9e98050ffcf to your computer and use it in GitHub Desktop.
Save nfsarmento/e636eca3ae103f6b7a99f9e98050ffcf to your computer and use it in GitHub Desktop.
ACF: Get Post Object data within a Repeater
<section class="slider">
<?php if( have_rows('slides') ): ?>
<div id="slider" class="flexslider">
<ul class="slides">
<?php while ( have_rows('slides') ) : the_row(); ?>
<li>
<?php $post_object = get_sub_field('featured_projects'); ?>
<?php if( $post_object ): ?>
<?php $post = $post_object; setup_postdata( $post ); ?>
<a href="<?php the_permalink(); ?>"><img src="<?php the_field('featured_image'); ?>" alt="<?php the_title(); ?>" /></a>
<?php wp_reset_postdata(); ?>
<?php endif; ?>
</li>
<?php endwhile; ?>
</ul>
</div>
<?php endif; ?>
</section>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment