<?php
/**
 * Template part for displaying front page introduction.
 *
 * @package Ostrich Magazine
 */

// Get the content type.
$more_news = get_theme_mod( 'ostrich_magazine_more_news', 'cat' );
// Bail if the section is disabled.
if ( get_theme_mod( 'ostrich_magazine_more_news_enable', 0 ) == 0 ) {
    return;
}

$get_content = ostrich_magazine_get_section_content( 'more_news', $more_news, get_theme_mod( 'ostrich_magazine_more_news_count', 5 )  );

?>
<div id="more-news">
    <div class="container">
        <div class="more-news-wrapper">
            <div class="section-header">
                <h2 class="section-title">Most News</h2>
            </div><!-- .section-header -->

            <div class="section-content">
                <div class="regular" data-slick='{"slidesToShow": 3, "slidesToScroll": 1, "infinite": true, "speed": 1000, "dots": true, "arrows":false, "autoplay": true, "draggable": true, "fade": false }'>
                    <?php foreach ( $get_content as $content ):  ?>
                    <article >
                        <div class="featured-image" style="background-image:url('<?php echo esc_url( get_the_post_thumbnail_url( $content['id'] ) ) ; ?>');">
                            <div class="overlay"></div>
                            <div class="entry-meta">
                                <span class="cat-links">
                                     <?php the_category( ' ', ' ', $content['id'] ); ?>
                                </span>
                            </div><!-- .entry-meta -->

                            <div class="post-wrapper">
                                <div class="entry-container">
                                    <header class="entry-header">
                                        <h2 class="entry-title"><a href="<?php echo esc_url( $content['url'] ); ?>" tabindex="0"><?php echo esc_html( $content['title'] ); ?></a></h2>
                                    </header>

                                    <div class="entry-content">
                                        <div class="footer-meta">
                                            <?php ostrich_magazine_posted_on( $content['id'] ); ?>
                                        
                                        </div><!-- .entry-meta -->
                                    </div>
                                </div><!-- .entry-container -->
                            </div><!-- .post-wrapper -->
                        </div><!-- .featured-image -->
                    </article>
                    <?php  endforeach ?>
                </div>
            </div>
        </div><!-- .more-news-wrapper -->
    </div><!-- .container -->
</div><!-- #more-news -->
