<?php
$at_hpblocks3 = get_theme_mod( 'at_setting__hpblocks3' );
$at_hpblockstitle3 = get_theme_mod('at_setting__hpblockstitle3', esc_html__( '3 reasons to work with me!', 'motivate' ));
$at_hpblocks3_nb = get_theme_mod('at_sec__hpblocks3_nb','3');
if ( $at_hpblocks3 ) : ?>
<div id="at-cta3-block" class="at-ctalist3">
  <div class="at-container">

    
    <?php if ( !empty($at_hpblockstitle3) ) : ?>
      <h3 class="at-ctalist__title"><?php echo esc_html($at_hpblockstitle3); ?></h3>
    <?php endif; ?> 

    <ul>
  <?php $i = 1;
  foreach($at_hpblocks3 as $item) : 
    
    
    $item_imgsrc = wp_get_attachment_image_src( $item['link_image'], 'motivate-mini-square'); ?>
    <li class="at-ctalist__block-<?php echo esc_html($at_hpblocks3_nb); ?>" >
    <div class="at-ctalist__blockoverflow">
    <?php if ( !empty($item['link_url']) ) : ?><a href="<?php echo esc_url($item['link_url']); ?>"></a><?php endif ?>
        <div class="at-ctalist__block"> 
          <img src="<?php echo esc_html($item_imgsrc[0]); ?>">
            

        </div>
        <?php if ( !empty($item['link_text']) ) : ?>
              <div class="at-ctalist__content-title">
                <?php if ( !empty($item['link_url']) ) : ?><a href="<?php echo esc_url( $item['link_url'] ); ?>"><?php endif ?> <h4><?php echo esc_html($item['link_text']); ?></h4><?php if ( !empty($item['link_url']) ) : ?></a> <?php endif ?> 
              </div> 
            <?php endif; ?>
      </div>
      <?php if ( !empty($item['link_description']) ) : ?>
        <div class="at-ctalist__blocktext3">
            <p><?php echo wp_kses_post($item['link_description']); ?></p>
            <?php if ( !empty($item['link_button']) ) : ?>
                <a id="cta2-<?php echo esc_html($i); ?>" class="at-ctalist__blockbutton" href="<?php echo esc_url( $item['link_url'] ); ?>"><span><?php echo esc_html($item['link_button']); ?></span></a>
            <?php endif; ?>
        </div>
        
      <?php endif; ?>

    </li>
  <?php ++$i;
  endforeach; ?>
    </ul>
  </div>
</div>
<?php endif; ?>