Support

Account

Home Forums Front-end Issues Hiding link if empty in a repeater row Reply To: Hiding link if empty in a repeater row

  • 
    <?php
    $rows = get_field('home' ); //get all rows
    shuffle ($rows); //randomize rows
    if($rows) {
    	foreach($rows as $row) { //print rows 
    if (!empty($row['link'])) {
    
    ?>
    		<div class="home-box">
    			<?php
    			echo '<a href="';
    			echo $row['link'];
    			echo '">';
    			echo $row['text'];
    			echo '</a>'
    			?>
    	</div>
    	<?php
    } // end if link !empty
    	}
    }
    
    ?>