<?php global $post; ?>
<div class="col-md-3 mt-3">
    <div class="card rounded-0 overflow-hidden lab" style=" height: 26rem;">
        <?php if (has_post_thumbnail($post->ID)) :
            $imageInfo = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'single-post-thumbnail');
            $imageUrl = $imageInfo[0]; ?>

            <img src="<?php echo $imageUrl ?>" class="department-image w-100" alt="...">
        <?php
        else:
            ?>
            <img src="<?php echo get_site_url(); ?>/wp-content/uploads/2024/07/2023052502551c6a8ee2-slider-security-1024x541-1.jpg"
                 class="department-image w-100" alt="...">
        <?php
        endif;
        ?>

        <div class="card-body lab_text">
            <a href="<?php the_permalink(); ?>">
                <h3 class="card-title fs-5 text-center fw-bolder">
                    <?php the_title(); ?>
                </h3>
            </a>

            <?php
                /**
                 * Custom Excerpt Length WordPress using wp_trim_excerpt()
                 * Use directly in template
                 */
                $excerpt = get_the_excerpt();
                echo ' <p>' . wp_trim_words($excerpt, '20') . '</p>';
            ?>
        </div>
    </div>
</div>