Created
April 26, 2017 09:21
-
-
Save nfsarmento/e636eca3ae103f6b7a99f9e98050ffcf to your computer and use it in GitHub Desktop.
ACF: Get Post Object data within a Repeater
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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