<?php if( have_rows('grid_six_cols') ): ?>
  <section class="home-section home-grid">
  	<ul class="grid">
  	<?php while( have_rows('grid_six_cols') ): the_row();
  		  // vars
    		$image = get_sub_field('image');
    		$title = get_sub_field('title');
    		$boxed = get_sub_field('boxed');
    		$link = get_sub_field('link');
  		?>
  		<li class="grid-element <?php if($boxed) echo 'boxed';?>">
  			<?php if( $link ): ?>
  				<a href="<?php echo $link['url']; ?>">
  			<?php endif; ?>
        <figure>
          <img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt'] ?>" title="<?= $title ?>" longdesc="<?= $title ?>"/>
        </figure>
        <header class="text-container">
          <h3 class="grid-title"><?php echo $title;?></h3>
        </header>
  			<?php if( $link ): ?>
  				</a>
  			<?php endif; ?>
  		</li>
  	<?php endwhile; ?>
  	</ul>
  </section>
<?php endif; ?>
