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

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

$get_content = ostrich_magazine_get_section_content( 'hot_topic', $hot_topic, 4  );

?>
<div id="hot-topic">
    <div class="container">
        <div class="hot-topic-wrapper">
            <?php if ( !empty( get_theme_mod( 'ostrich_magazine_hot_topic_label', '' ) ) ): ?>
                <div class="section-header">
                    <h2 class="section-title"><?php echo esc_html( get_theme_mod( 'ostrich_magazine_hot_topic_label', '' ) ) ?></h2>
                </div><!-- .section-header -->

            <?php endif ?>
            
            <div class="section-content col-4 clear">
               <?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><!-- .entry-content -->
                                </div><!-- .entry-container -->
                            </div><!-- .post-wrapper -->
                        </div>
                    </article>
               <?php endforeach ?>
            </div>
        </div><!-- .hot-topic-wrapper -->
    </div><!-- .container -->
</div><!-- #hot-topic -->