<?php
    $query = new WP_Query([
        'post_type' => 'post',
        'posts_per_page' => -1,
    ]);
    $news = $query->posts;
?>
<?php  if ( $news ) : ?>
    <aside class="wyn-hero-home-newsoffers">
        <div class="newsoffers-slides">
            <?php foreach ( $news as $key => $post ): ?>
                <div class="wyn-newsoffer-item">
                    <div class="wyn-newsoffer-item-image">
                        <div class="image" title="<?= $post->post_title ?>" style="background-image: url(<?php if ( has_post_thumbnail($post->ID ) ) {the_post_thumbnail_url($post->ID); }?>);"></div>
                    </div>
                    <div class="wyn-newsoffer-item-info">
                        <p class="type"><?php echo __( 'News', 'felicityhealth' );?></p>
                        <h4><?= $post->post_title ?></h4>
                        <div class="item-copy">
                            <p><time datetime="<?php echo get_the_date('F j, Y'); ?>" title="<?php echo get_the_date('F j, Y'); ?>"><?php echo get_the_date('F j, Y'); ?></time></p>
                            <a href="<?= esc_url( get_permalink($post->ID) )?>" class="link" target="_self"><?php echo __( 'Read Now', 'felicityhealth' );?></a>
                        </div>
                    </div>
                </div>
            <?php endforeach; ?>
        </div>
        <div class="newsoffer-carousel-controls"></div>
    </aside>
<?php endif; ?> 
<?php wp_reset_query(); ?>