<?php
/**
 * Template part for displaying front page imtroduction.
 *
 * @package Moral
 */

// Get the content type.
$breaking_news = get_theme_mod( 'moral_magazine_breaking_news', 'disable' );
$breaking_news_num	= 4;
// Bail if the section is disabled.
if ( 'disable' === $breaking_news ) {
	return;
}

$content_details = moral_magazine_get_section_content( 'breaking_news', $breaking_news, $breaking_news_num );

?>
<div id="magazine_pro_breaking_news_section" class="relative page-section breaking_news">
    <div class="wrapper">
        <div class="breaking-news-post">
            <h2 class="news-title"><?php echo esc_html( get_theme_mod( 'moral_magazine_breaking_news_label', __( 'Breaking News', 'moral-magazine' ) ) ); ?></h2>
            <div class="aft-ripple">
                <div></div>
                <div></div>
            </div>
            <div class="breaking-news-slider" data-slick='{"slidesToShow": 3, "slidesToScroll": 1, "infinite": true, "speed": 500, "dots": false, "arrows":false, "autoplay": true, "draggable": true, "fade": false, "adaptiveHeight": true }'>
                <?php foreach ( $content_details as $content ): ?>
                    <article>
                        <div class="breaking-news-wrapper">
                            <div class="featured-image">
                                <img src="<?php echo esc_url( get_the_post_thumbnail_url( $content['id'], 'thumbnail' ) ) ; ?>">
                            </div>
                            <div class="entry-container">
                                <header class="entry-header">
                                    <h2 class="entry-title"><a href="<?php echo esc_url( $content['url'] ) ; ?>"><?php echo esc_html( $content['title'] ); ?></a></h2>
                                </header>
                            </div><!-- .entry-container -->
                        </div>
                    </article>
                <?php endforeach ?>
            </div><!-- section-content -->
        </div>
    </div>
</div><!-- #magazine_pro_breaking_news_section -->

