Support

Account

Home Forums Add-ons Repeater Field Repeater Field Reverse / Inverse Order

Solving

Repeater Field Reverse / Inverse Order

  • Hey Elliot! I need to reverse the order that a repeater field’s rows are displayed in… Could you help me out?

    <?php if( have_rows('galleries') ): $row = 0; ?>
     
    	<div id="results_container" class="container">
     
    	<?php while( have_rows('galleries') ): the_row(); $row++; ?>
     
    		<div class="results_cover three columns">
    		
    			<a href="#gallery_<?php echo $row; ?>" class="open-album" data-open-id="album-<?php echo $row; ?>"><img src="<?php the_sub_field('cover'); ?>"></a><!-- COVER (TRIGGER) -->
    
    		</div>
    		
    		<div style="display:none"><!-- hidden container -->
    		
    			<div id="gallery_<?php echo $row; ?>"><!-- GALLERY -->
    			
    				<a rel="album-<?php echo $row; ?>" class="image-show" href="<?php the_sub_field('cover'); ?>"></a>
    			
    				<?php $images = get_sub_field('gallery');
    				if( $images ): foreach( $images as $image ): ?>
    						
    						<a rel="album-<?php echo $row; ?>" class="image-show" href="<?php echo $image['url']; ?>"></a>
    						
    				<?php endforeach; endif; ?>
    				
    			</div>
    		
    		</div><!-- end hidden container -->
    										
    	<?php endwhile; ?>
     
    	</div>
     
    <?php endif; ?>

    Ross

  • Can anyone else help out? I’ve seen a lot of “tips” online about doing this, but none seem to be based on the standard repeater code as per this example.

    Thanks.

  • Anyone ever figure this out? I need to do the same thing!

  • Any news about that ?

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

You must be logged in to reply to this topic.