Support

Account

Forum Replies Created

  • Yeah for solutions!

    http://stackoverflow.com/questions/21135959/get-first-row-image-of-acf-repeater-field

    My Code

     <?php $first_mm_stats = true; ?
           <?php while ( $first_mm_stats && have_rows('mm-stats') ) : the_row(); ?>
    
            <?php $first_article_stat = true; ?>
                 <?php while ( $first_article_stat && has_sub_field('article_stat') ): ?>
    
                <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 $first_article_stat = false; ?>
                  <?php endwhile; ?>
                  
                  <?php $first_mm_stats = false; ?>
              <?php  endwhile; ?>
    
      </div>
  • 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;?>
  • Read this and wasn’t able to make it work for me.

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