I trying to load a repeater field from related posts with advanced custom field.
I have a post who has a relationship to load posts from another post_type. Then this post_type has a repeater_field. I tried to load these repeater_fields of my related posts. Its a object inside another object.
Here is my code:
<?php
$posts = get_field('related_posts'); // this is a relation field
if( $posts ):
foreach( $posts as $p ):
?>
<section class="slider">
<?php
$quotes = get_field('slider_quotes'); // this is my repeater field
if( have_rows($quotes) ):
while ( have_rows($quotes) ) : the_row();
?>
<div><h2><?php echo get_sub_field('quote'); ?></h2></div>
<?php endwhile; else:
echo "Nothing yet";
endif; ?>
</section>
I already tried:
$frases = get_field('slider_quotes', $p->ID);
and
<?php echo get_sub_field('quotes', $p->ID); ?>
And I got nothing.
Thanks!
FULL CODE