Home › Forums › Add-ons › Repeater Field › Relationship field in repeater field
Hi,
I have a problem with list post title and other properties of post in repeater field.
Here is my code:
<div class=”row second-page”>
<?php $program_posts = get_field(‘programs’); ?>
<!– Shows list–>
<div class=”col-md-9″>
<?php $i = 0; foreach ($program_posts as $post) {
$i++; ?>
<?php setup_postdata($post);
$field = get_field_object(‘show_category’);
$value = $field[‘value’];
$label = $field[‘choices’][ $value ];
?>
” id=”<?php echo $value; ?>” class=”show-block”>
<p class=”show-block__category”><?php echo $label; ?></p>
<h1 class=”show-block__title”><?php the_title(); ?></h1>
<p><?php the_content(); ?></p>
<?php if (get_field(‘program_list’)): $i = 0; ?>
<div class=”col-md-12 show-page__video”>
<div class=”row”>
<?php while (have_rows(‘program_list’)): the_row();
$i++; ?>
<div class=”col-md-12″>
<?php the_sub_field(‘program_time’); ?>
<?php print count(get_sub_field(‘program_show’)); ?>
<?php $myposts = get_sub_field(‘program_show’);
if ($myposts): ?>
<div class=”col-md-12 section section–grey”>
<div class=”row”>
<?php foreach ($myposts as $show): ?>
Here i am getting title from $post, and I want title from $show
<?php the_title(); ?>
<?php endforeach; ?>
</div>
</div>
<?php endif; ?>
</div>
<?php endwhile; ?>
</div>
</div>
<?php endif; ?>
<?php } ?>
<?php wp_reset_postdata(); ?>
</div>
</div>
The topic ‘Relationship field in repeater field’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.