Support

Account

Home Forums Add-ons Repeater Field Grid based layout and repeater help needed Reply To: Grid based layout and repeater help needed

  • Hi James,
    I solved it with a little tweak to your code, thanks for getting me pretty much there!

    <?php if( have_rows('factsheets') ): ?>
    
    	<div class="vc_row wpb_row vc_row-fluid dt-default" style="margin-top: 0px; margin-bottom: 0px; min-height: 0px;">
    		<?php while( have_rows('factsheets') ): the_row(); 
    
    					// vars
    					$factsheet_title = get_sub_field('factsheet_title');
    					$factsheet_pdf = get_sub_field('factsheet_pdf');
    					?>
    
    			<div class="wpb_column vc_column_container vc_col-sm-3">
    				<div class="vc_column-inner ">
    					<div class="wpb_wrapper">
    						<a href="<?php echo $factsheet_pdf['url']; ?>"><img src="/pdf-logo.png" /></a>
    						<span><?php echo $factsheet_title; ?></span>
    					</div>
    				</div>
    			</div>
    
    	<?php
    	if( get_row_index() % 4 == 0  ){
    		// Close the div and open it again
    		echo '</div><div class="vc_row wpb_row vc_row-fluid dt-default" style="margin-top: 0px; margin-bottom: 0px; min-height: 0px;">';
    	}
    	?>
    
    		<?php endwhile; ?>
    	</div>
    
    <?php endif; ?>