Home › Forums › Add-ons › Repeater Field › Return one row of nested repeater sub_fields › Reply To: Return one row of nested repeater sub_fields
Getting closer, but still missing some pieces. I’ve managed to show the first stat for the first post but the rest of the posts don’t show. If I change the count to 4 the loop shows the next stat in the same post. After the loop shows all the stats in that first post it moves on to the next post displaying until reaching the count break. Thanks for any help.
<?php
$temp = $wp_query;
$wp_query = null;
$wp_query = new WP_Query();
$wp_query->query('showposts=4&post_type=market-minute'.'&paged='.$paged);
while ($wp_query->have_posts()) : $wp_query->the_post();
?>
<article class="row">
<h2 class="col-sm-9 col-sm-offset-3"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<?php if( have_rows('mm-stats') ): ?>
<?php while ( have_rows('mm-stats') ) : the_row(); ?>
<?php if( have_rows('article_stat') ): ?>
<div class="archive-stat col-sm-3 text-right">
<?php while ( have_rows('article_stat') ): the_row(); ?>
<?php $i++; ?>
<?php if( $i > 1 ):
break; ?>
<?php endif; ?>
<h4><?php the_sub_field('name'); ?></h4>
<div class="stat-box" rel="tooltip" data-toggle="tooltip" data-placement="top" title="Last Year to Date">
<p class="value">
<?php the_sub_field( 'value' ); ?><i class="fa fa-info-circle"></i>
</p>
<p class="indicator <?php the_sub_field('indicator'); ?>">
<i class="fa fa-arrow-<?php the_sub_field('indicator'); ?>"></i><?php the_sub_field( 'percent' ); ?>% <label><span>Lytd</span></label>
</p>
</div>
<a class="read-more" href="<?php the_permalink(); ?>">More Stats</a>
<?php endwhile; ?>
</div>
<?php endif; endwhile; endif; ?>
<p class="meta col-sm-9"><em>
<?php echo the_time('F jS, Y'); ?>
</em></p>
<div class="col-sm-9">
<?php
if(!$post->post_excerpt) {
the_content();
} else {
the_excerpt();
}
?>
</div>
</article>
<hr />
<?php endwhile;?>
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.