Home Forums Add-ons Repeater Field Displaying Repeater Fields


Displaying Repeater Fields

  • 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%”>


    $post_object = get_field(‘blog2’);

    if( $post_object ):

    // override $post
    $post = $post_object;
    setup_postdata( $post );


    <article class=”teaser5″>

    ” class=”teaser5-header”>

    <figure class=”teaser5-image “>
    <span class=”img1″ style=”padding-top: 75%”>

    <?php the_post_thumbnail( ‘medium’ ); ?>


    <h3 class=”teaser5-title -ts:4″>
    <?php the_title(); ?> </h3>

    <?php echo wp_trim_words( get_the_content(), 60 );?>

    <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>

    // 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
    else :
    // no rows found

    <?php wp_reset_postdata(); // IMPORTANT – reset the $post object so the rest of the page works correctly ?>
    <?php endif; ?>



    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.

Viewing 1 post (of 1 total)

The topic ‘Displaying Repeater Fields’ is closed to new replies.