<?php
    $title    = $args['title'];
    $category = $args['category'];
    $class    = isset($args['class']) ? $args['class'] : '';

    $args = array(
        'post_type'           => 'testimonials',
        'post_status'         => 'publish',
        'ignore_sticky_posts' => 1,
        'posts_per_page'      =>-1,
        'orderby'             => 'ASC',
        'order'               => 'ASC',
        'tax_query'           => array(array(
            'taxonomy'      => 'testimonials_categories',
            'field'         => 'slug', //This is optional, as it defaults to 'term_id'
            'terms'         => $category ? $category : '',
            'operator'      => 'IN' // Possible values are 'IN', 'NOT IN', 'AND'.
        ))
    );

    $the_query = new WP_Query( $args );
?>

<section class="section satisfied-customer <?php echo $class; ?>">
    <div class="container">
        <div class="text-cont">
            <h2 class="section-title">
                <?php echo get_field('testimonials_title'); ?>
            </h2>
			<p class="section-content"><?php echo get_field('testimonials_text'); ?></p>
			
        </div>
      <div class="row">
          <div class="col-lg-6">
              <div class="img-cont slide-right">
                  <img src="<?php echo get_template_directory_uri(); ?>/assets/img/poster1.webp" alt="<?php echo strip_tags( get_field('testimonials_title') ); ?>" class="img-fluid" loading="lazy">
              </div>
          </div>
          <div class="col-lg-6">
              <div class="owl-carousel owl-theme satisfied-customer-slider">
              <?php
                if ($the_query->found_posts!=0)
                {
                   
                    while ( $the_query->have_posts() ) : $the_query->the_post();
                    $post_id=get_the_ID();
                        $titles  = get_the_title();
                        $content = get_the_content(); 
                        $featured_image_url = get_the_post_thumbnail_url($post_id, 'full'); 
                         ?>
                  <div class="item">
                     <div class="text-content slide-up" >
                         <p>
                            <?php echo $content; ?>
                         </p>
                         <h3><?php echo $titles; ?></h3>
                     </div>
                  </div><?php
                      
                    endwhile;
                    wp_reset_postdata();
                    wp_reset_query();
                }
                ?>
                  
              </div>
              <div class="brand-logos slide-up">
                  <img src="<?php echo get_template_directory_uri(); ?>/assets/img/brands-logos2.webp" alt="Customers' Logos" class="img-fluid">
              </div>
          </div>
      </div>
    </div>
</section>