<?php 
$mobile_app_launch_slider_arrows = get_theme_mod('mobile_app_launch_slider_arrows',false);
?>
<?php if ($mobile_app_launch_slider_arrows) : ?>
  <section id="slider">
    <div class="owl-carousel owl-theme">
      <?php 
      $mobile_app_launch_slide_pages = array();
      for ( $mobile_app_launch_count = 1; $mobile_app_launch_count <= 4; $mobile_app_launch_count++ ) {
        $mobile_app_launch_mod = intval( get_theme_mod( 'mobile_app_launch_slider_page' . $mobile_app_launch_count ) );
        if ( $mobile_app_launch_mod && 'page-none-selected' !== $mobile_app_launch_mod ) {
            $mobile_app_launch_slide_pages[] = $mobile_app_launch_mod;
        }
      }
      if (!empty($mobile_app_launch_slide_pages)) :
        $mobile_app_launch_args = array(
          'post_type' => 'page',
          'post__in' => $mobile_app_launch_slide_pages,
          'orderby' => 'post__in'
        );
        $mobile_app_launch_query = new WP_Query($mobile_app_launch_args);
        if ($mobile_app_launch_query->have_posts()) :
          while ($mobile_app_launch_query->have_posts()) : $mobile_app_launch_query->the_post(); ?>
            <div class="container">
              <div class="item">
                <div class="row">
                  <div class="col-lg-6 col-md-6 col-12 slider-content-col align-self-center">
                    <div class="carousel-captions">
                      <div class="inner_carousel wow fadeInUp" data-wow-delay="0.5s">
                        <h1 class="mb-2">
                          <a href="<?php the_permalink(); ?>">
                            <?php 
                              $mobile_app_launch_title = get_the_title(); 
                              $mobile_app_launch_words = explode(' ', $mobile_app_launch_title); 
                              $mobile_app_launch_last_word = array_pop($mobile_app_launch_words); 
                              $mobile_app_launch_remaining_title = implode(' ', $mobile_app_launch_words);
                            ?>
                            <?php echo esc_html($mobile_app_launch_remaining_title); ?> 
                            <span class="highlight"><?php echo esc_html($mobile_app_launch_last_word); ?></span>
                          </a>
                        </h1>
                        <p class="mb-2 slider-content"><?php echo wp_kses_post(wp_trim_words(get_the_content(), 28)); ?></p>
                        <div class="more-btn mt-4">
                          <a href="<?php the_permalink(); ?>" class="text-capitalize me-lg-4 me-md-3 me-2 mb-3 slider-btn1"><?php esc_html_e('Get Started', 'mobile-app-launch'); ?></a>
                        </div>
                      </div>
                    </div>
                  </div>
                  <div class="col-lg-6 col-md-6 col-12 slider-img-col align-self-center">
                    <?php if (has_post_thumbnail()) : ?>
                      <img src="<?php the_post_thumbnail_url('full'); ?>" alt="<?php the_title_attribute(); ?>" />
                    <?php else : ?>
                      <div class="slider-img-color"></div>
                    <?php endif; ?>
                  </div>
                </div>
              </div>
            </div>
          <?php endwhile;
          wp_reset_postdata();
        else : ?>
          <div class="no-postfound"><?php esc_html_e('No posts found', 'mobile-app-launch'); ?></div>
        <?php endif;
      endif; ?>
    </div>
    <div class="clearfix"></div>
  </section>
<?php endif; ?>
