Home Forums Add-ons Repeater Field Relationship field in repeater field


Relationship field in repeater field

  • I’ve a rpeater field that contain 4 sub_fields.
    3 text sub field and 1 relationship field.
    i can get the value for the text subfield but i can’t get value for relationship field. why?

                            // check if the repeater field has rows of data
                            if( have_rows('appuntamento') ):
                                // loop through the rows of data
                                while ( have_rows('appuntamento') ) : the_row();
    						<p class="data"><?php the_sub_field('ora_appuntamento');?>, <?php the_sub_field('luogo_appuntamento');?>
    						<?php $posts = get_sub_field('autore_appuntamento');
                            if( $posts ): ?>
                                <?php foreach( $posts as $post_object): ?>
    	                        	<a href="<?php echo get_permalink($post_object->ID); ?>"><?php echo get_the_title($post_object->ID); ?></a>
                                <?php endforeach; ?>
                            <?php endif;?>
    						<?php the_sub_field('descrizione_appuntamento');?>
                            else :
                                // no rows found
  • Solved. i’ve replaced $posts with $myposts

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

The topic ‘Relationship field in repeater field’ is closed to new replies.