<?php 
  $film_studio_latest_movie = get_theme_mod('film_studio_latest_movie_setting',true);
  
  if($film_studio_latest_movie == '1') {
?>
  <section id="top-movies-section" class="second-main-box py-5">
    <div class="container">
      <?php
        $film_studio_movies_section_title = get_theme_mod( 'movies_section_title' );
        $film_studio_movies_section_btn_text = get_theme_mod( 'movies_section_btn_text' );
        $film_studio_movies_section_btn_link = get_theme_mod( 'movies_section_btn_link' );
      ?>
      <div class="movies_heading pb-4">
        <?php if( $film_studio_movies_section_title != ''){?>
          <h2 class="text-center text-md-start"><?php echo apply_filters('film_studio_movies_section', $film_studio_movies_section_title); ?></h2>
        <?php }?>
        <?php if( $film_studio_movies_section_btn_link != '' || $film_studio_movies_section_btn_text != ''){?>
          <a href="<?php echo apply_filters('film_studio_movies_section', $film_studio_movies_section_btn_link); ?>" class="sec-btn"><?php echo apply_filters('film_studio_movies_section', $film_studio_movies_section_btn_text); ?><i class="fas fa-chevron-right ms-2"></i></a>
        <?php }?>
      </div>
      <?php
        for ( $s = 1; $s <= 8; $s++ ) {
          $film_studio_mod =  get_theme_mod( 'film_studio_movies_section_settigs' .$s );
          if ( 'page-none-selected' != $film_studio_mod ) {
            $film_studio_post[] = $film_studio_mod;
          }
        }
         if( !empty($film_studio_post) ) :
        $film_studio_args = array(
          'post_type' =>array('post','page'),
          'post__in' => $film_studio_post,
          'post__not_in' => get_option("sticky_posts")
        );
        $film_studio_query = new WP_Query( $film_studio_args );
        if ( $film_studio_query->have_posts() ) :
          $s = 1;
      ?>
      
      <div class="row">
        <?php  while ( $film_studio_query->have_posts() ) : $film_studio_query->the_post(); ?>
          <div class="col-lg-3 col-md-3 mb-4 wow zoomInUp" data-wow-delay="0.5s">
            <div class="<?php echo (has_post_thumbnail()) ? '' : ' color-img'; ?>">
              <div class="inner-box-image">
                <?php if (has_post_thumbnail()) : ?>
                  <img src="<?php the_post_thumbnail_url('full'); ?>"/>
                <?php endif; ?>
              </div>
            </div>
            <div class="inner-box py-2">
              <h3><a href="<?php the_permalink(); ?>"><?php the_title();?></a></h3>
              <?php 
                $film_studio_excerpt = get_the_excerpt(); 
                if ($film_studio_excerpt) {
                    echo '<p class="my-2 movie-content">' . esc_html( film_studio_string_limit_words( $film_studio_excerpt, 5 ) ) . '</p>'; 
              } ?>
            </div>
          </div>
        <?php $s++; endwhile; ?>
      </div>
      <?php wp_reset_postdata();
      else : ?>
      <div class="no-postfound"></div>
        <?php endif;
      endif;?>
    </div>
  </section>
<?php } ?>