Support

Account

Home Forums General Issues Repeater – Sub Field Values – Not Displaying

Solving

Repeater – Sub Field Values – Not Displaying

  • Hello

    I’m having issues getting the sub_field values to display within a repeater field.

    See the code below.

    The other normal fields (post_excerpt) displays fine but the “link_title” and “link_url” within the repeater wont show. The IF Condition works fine for if( have_rows(‘related_post_links’) ): therefore it is recognising the repeater and that there are values avaiable.

    I’ve tried “get_sub_field” and “the_sub_field”.

    Any suggestions appeciated.

    <?php echo get_field( "post_excerpt" ); ?>
    
    <?php
    
    // check if the repeater field has rows of data
    if( have_rows('related_post_links') ):
    
     	// loop through the rows of data
        while ( have_rows('related_post_links') ) : the_row();
    
            echo get_sub_field('link_title');
    
            echo get_sub_field('link_url');
    
        endwhile;
    
    else :
    
        echo "No other links.";
    
    endif;
    
    ?>
  • Going to need more information, there’s nothing in the code you’ve provided that would explain why it’s not working.

    Let’s start with your field group. Please export your field group and attach it, you’ll probably need to put it in a .zip file to attach it here.

  • Hi, sorry I didn’t reply. I managed to figure it out, was a problem with my ACF options not the code.

    Thanks!

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Repeater – Sub Field Values – Not Displaying’ is closed to new replies.