<?php
$at_hpblocks2 = get_theme_mod( 'at_setting__hpblocks2' );
$at_hpblockstitle2 = get_theme_mod('at_setting__hpblockstitle2', esc_html__( 'What I can do for you', 'motivate' ));
$at_hpblockszoom2 = get_theme_mod('at_setting__hpblockszoom2','1');
$at_hpblocks2_nb = get_theme_mod('at_sec__hpblocks2_nb','3');
if ( $at_hpblocks2 ) : ?>
<div id="at-cta2-block" class="at-ctalist2">
  <div class="at-container">

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

    <ul>
  <?php $i = 1;
  foreach($at_hpblocks2 as $item) : 
    
    
    $item_imgsrc = wp_get_attachment_image_src( $item['link_image'], 'motivate-500'); ?>
    <li class="at-ctalist__block-<?php echo esc_html($at_hpblocks2_nb); ?>" >
    <div class="at-ctalist__blockoverflow <?php if ($at_hpblockszoom2 == 1) echo 'at-ctalist__blockoverzoom2' ; ?>">
    <a href="<?php echo esc_url($item['link_url']); ?>"></a>
        <div class="at-ctalist__block <?php if (!(empty($item['link_image']))) echo 'at-ctalist__block--hasimage' ; ?>" style="background-image: url(<?php echo esc_url($item_imgsrc[0]); ?>);">
            <?php if ( !empty($item['link_text']) ) : ?>
              <div class="at-ctalist__content">
                <a href="<?php echo esc_url( $item['link_url'] ); ?>"> <h4><?php echo esc_html($item['link_text']); ?></h4></a> 
              </div> 
            <?php endif; ?>

        </div>
      </div>
      <?php if ( !empty($item['link_description']) ) : ?>
        <div class="at-ctalist__blocktext">
            <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; ?>