<?php if ( get_theme_mod('freelancer_digital_agency_blog_box_enable',false) ) : ?>

<?php $freelancer_digital_agency_args = array(
  'post_type' => 'post',
  'post_status' => 'publish',
  'category_name' =>  get_theme_mod('freelancer_digital_agency_blog_slide_category'),
  'posts_per_page' => get_theme_mod('freelancer_digital_agency_blog_slide_number'),
); ?>

<div class="slider">
  <div class="owl-carousel">
    <?php $freelancer_digital_agency_arr_posts = new WP_Query( $freelancer_digital_agency_args );
    if ( $freelancer_digital_agency_arr_posts->have_posts() ) :
      while ( $freelancer_digital_agency_arr_posts->have_posts() ) :
        $freelancer_digital_agency_arr_posts->the_post();
        ?>
        <div class="blog_inner_box">
          <?php
            if ( has_post_thumbnail() ) :
              the_post_thumbnail();
            else:
              ?>
              <div class="slider-alternate">
                <img src="<?php echo get_stylesheet_directory_uri() . '/assets/images/banner.png'; ?>">
              </div>
              <?php
            endif;
          ?>
          <div class="blog_box pt-3 pt-md-0 wow zoomIn">
            <?php if ( get_theme_mod('freelancer_digital_agency_slider_extra_heading') ) : ?>
              <h5><?php echo esc_html(get_theme_mod('freelancer_digital_agency_slider_extra_heading'));?></h5>
            <?php endif; ?>
            <?php if ( get_theme_mod('freelancer_digital_agency_title_unable_disable',true) ) : ?>
              <h3 class="my-3"><?php the_title(); ?></a></h3>
            <?php endif; ?>
            <?php if ( get_theme_mod('freelancer_digital_agency_slide_text_unable_disable',true) ) : ?>
              <p class="slide-post mb-0"><?php echo wp_trim_words( get_the_content(), 25 ); ?></p>
            <?php endif; ?> 
            <?php if ( get_theme_mod('freelancer_digital_agency_button_unable_disable',true) ) : ?>
              <p class="slider-button mt-4">
                <a href="<?php echo esc_url(get_permalink($post->ID)); ?>"><?php esc_html_e('Lets Talk','freelancer-digital-agency'); ?></a>
              </p>
            <?php endif; ?>
            <?php if ( get_theme_mod('freelancer_digital_agency_header_phone_number') || get_theme_mod('freelancer_digital_agency_header_email') ) : ?>
              <div class="call-info-box">
                <h4><?php esc_html_e('Any Question','freelancer-digital-agency'); ?></h4>
                <div class="call-info">
                  <p class="mb-0"><i class="fas fa-phone me-2"></i><a href="callto:<?php echo esc_html(get_theme_mod('freelancer_digital_agency_header_phone_number','')); ?>"><?php echo esc_html(get_theme_mod('freelancer_digital_agency_header_phone_number','')); ?></a></p>
                  <p class="mb-0"><i class="fas fa-paper-plane me-2"></i><a href="mailto:<?php echo esc_html(get_theme_mod('freelancer_digital_agency_header_email','')); ?>"><?php echo esc_html(get_theme_mod('freelancer_digital_agency_header_email','')); ?></a></p>
                </div>
              </div>
            <?php endif; ?>
          </div>
          <div class="social-links">
            <?php $freelancer_digital_agency_settings = get_theme_mod( 'freelancer_digital_agency_social_links_settings' ); ?>
            <?php if ( is_array($freelancer_digital_agency_settings) || is_object($freelancer_digital_agency_settings) ){ ?>
              <?php foreach( $freelancer_digital_agency_settings as $freelancer_digital_agency_setting ) { ?>
                <a href="<?php echo esc_url( $freelancer_digital_agency_setting['link_url'] ); ?>">
                    <i class="<?php echo esc_attr( $freelancer_digital_agency_setting['link_text'] ); ?>"></i>
                </a>
              <?php } ?>
            <?php } ?>
          </div>
        </div>
      <?php
    endwhile;
    wp_reset_postdata();
    endif; ?>
  </div>
</div>

<?php endif; ?>
