I am using ACF to allow the user to choose a blog to display on their homepage. I’ve managed to get that to work using a Post Object field, and then calling the title, link, and content using WP hooks. However, the blog also has a repeater field associated with it for “authors” as they want to be bale to specify a different author for their posts than the person who published them. My problem is, I can’t for the life of me figure out how to get this repeater field to display for the blog post. Here’s the code I am using.
<div style=”width:49%;float:left;margin:.5%”>
<?php
$post_object = get_field(‘blog2’);
if( $post_object ):
// override $post
$post = $post_object;
setup_postdata( $post );
?>
<div>
<article class=”teaser5″>
” class=”teaser5-header”>
<figure class=”teaser5-image “>
<span class=”img1″ style=”padding-top: 75%”>
<?php the_post_thumbnail( ‘medium’ ); ?>
</span>
</figure>
<h3 class=”teaser5-title -ts:4″>
<?php the_title(); ?> </h3>
<p>
<?php echo wp_trim_words( get_the_content(), 60 );?>
</p>
<div style=”width:100%;overflow:auto;”>
<p style=”float:left;width:50%;”><?php the_time(‘M-d-Y’); ?></p>
<p style=”float:left;width:50%;”>” title=”<?php echo esc_attr( get_the_author() ); ?>”><?php the_author(); ?></p>
<?php
// check if the repeater field has rows of data
if( have_rows(‘authors’) ):
// loop through the rows of data
while ( have_rows(‘authors’) ) : the_row();
// display a sub field value
the_sub_field(‘author’);
endwhile;
else :
// no rows found
endif;
?>
</div>
</article>
</div>
<?php wp_reset_postdata(); // IMPORTANT – reset the $post object so the rest of the page works correctly ?>
<?php endif; ?>
</div>
</div>
The repeater field “author” doesn’t show up no matter what I do. I can call the publisher of the post using WP Functions but that isn’t what I need. Thank you in advance for any help any of you can provide.