<?php
$title    = $args['title'];
$content  = $args['content'];
$category = $args['category'];

$args = array(
    'post_type'           => 'inventory',
    'post_status'         => 'publish',
    'ignore_sticky_posts' => 1,
    'posts_per_page'      =>-1,
    'orderby'             => 'ASC',
    'order'               => 'ASC',
    'tax_query'           => array(array(
        'taxonomy'      => 'inventory_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 inventory-lifecycle">
    <div class="container">
        <div class="text-cont slide-up">
            <h2 class="section-title"><?php echo $title; ?></h2>
            <p class="section-content"><?php echo $content; ?></p>
        </div>
        <ul>
        <?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'); 
                         ?>
            <li class="slide-down">
                <span class="left">
                    <?php echo $titles; ?>
                </span>
                <span class="right">
                    <a href="<?php echo get_field('inventory_link'); ?>" aria-label="<?php echo $titles; ?>">
                        <svg width="39" height="36" viewBox="0 0 39 36" fill="none" xmlns="http://www.w3.org/2000/svg">
                        <rect opacity="0.2" x="0.25" y="0.499023" width="38.5" height="34.5" rx="4.75" stroke="white"
                              stroke-width="0.5"/>
                        <path d="M25.8789 16.4517L21.2735 12.0869L19.7566 13.5246L23.2892 16.8727H12.5615V18.9061H23.2892L19.7566 22.2542L21.2735 23.6919L25.8789 19.3271C26.2811 18.9457 26.5071 18.4286 26.5071 17.8894C26.5071 17.3502 26.2811 16.8331 25.8789 16.4517Z"
                              fill="white"/>
                        </svg>
                    </a>
                </span>
            </li>
            <?php
                    endwhile;
                    wp_reset_postdata();
                    wp_reset_query();
                }
                ?>
            
        </ul>
    </div>
</section>