<?php
$class = isset($args['class']) ? $args['class'] : '';
$category = isset($args['category']) ? $args['category'] : '';
$query_args = array(
    'post_type'           => 'industry',
    'post_status'         => 'publish',
    'ignore_sticky_posts' => 1,
    'posts_per_page'      => -1,
    'orderby'             => 'menu_order',
    'order'               => 'ASC',
    'tax_query'           => array(array(
        'taxonomy' => 'industry_categories',
        'field'    => 'slug',
        'terms'    => $category ? $category : 'all',
        'operator' => 'IN'
    ))
);

$industries = new WP_Query($query_args);

?>


<?php if ($industries->have_posts()) : ?>

<section class="section tracking-serves-industries <?php echo $class?>">
    <div class="container">
       <div class="row ">
           <div class="col-lg-6 col-xl-7">
               <h2 class="section-title mb-3 text-lg-start text-center">
                   <?php echo get_field('indust_tracking_section_title'); ?>
               </h2>
           </div>
           <div class="col-lg-6 col-xl-5"><p class="section-content text-lg-start text-center"><?php echo get_field('indust_tracking_section_text'); ?></p></div>
        </div>
    </div>
    <div class="owl-carousel owl-theme tracking-serves-industries-slider">
            <?php while ($industries->have_posts()) : $industries->the_post(); ?>
                <div class="item">
                    <div class="inner">
                        <div class="image">
                            <img src="<?php echo get_field('industry_image'); ?>" alt="<?php echo strip_tags(get_the_title()); ?>" class="img-fluid">
                        </div>
                        <div class="text-box">
                            <h3 class="indust-name"><?php echo get_the_title(); ?></h3>
                            <p class="indus-desc hidden-text"><?php echo get_the_content(); ?></p>
                        </div>
                    </div>
                </div>
                <?php endwhile; ?>
                <?php wp_reset_postdata(); ?>
    </div>
    
    <?php $cta = get_field('indust_tracking_section_button'); 
    if($cta):?>
    <div class="req-demo-btn-wrapper mt-4 text-center">
        <a href="<?php echo esc_url($cta['url']); ?>" class="purple-outline-btn animated-btn " <?php echo is_modal_link($cta['url']); ?>><?php echo $cta['title']; ?></a>
    </div>
    <?php endif; ?>

</section>

<?php endif; ?>