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


// Bail if the section is disabled.
if ( get_theme_mod( 'ostrich_magazine_recent_enable', 0 ) == 0 ) {
    return;
}

$get_first_content = ostrich_magazine_get_section_content( 'recent', 'cat_1', get_theme_mod( 'ostrich_magazine_recent_count', 3 )  );
$get_second_content = ostrich_magazine_get_section_content( 'recent', 'cat_2', get_theme_mod( 'ostrich_magazine_recent_count', 3 )  );

?>
<div id="two-column">
    <div class="two-column-wrapper clear">
         <?php if ( !empty( get_theme_mod( 'ostrich_magazine_recent_label', '' ) ) ): ?>
                <div class="section-header">
                    <h2 class="section-title"><?php echo esc_html( get_theme_mod( 'ostrich_magazine_recent_label', '' ) ) ?></h2>
                </div><!-- .section-header -->

            <?php endif ?>

        <div class="section-content">
            <div class="column-wrapper">
                <?php foreach ($get_first_content as $content): ?>
                    <article>
                        <div class="featured-image" style="background-image:url('<?php echo esc_url( get_the_post_thumbnail_url( $content['id'] ) ) ; ?>');">
                        </div><!-- .featured-image -->

                        <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="footer-meta">
                                <?php ostrich_magazine_posted_on( $content['id'] ); ?>
                            </div><!-- .footer-meta -->
                        </div><!-- .entry-container -->
                    </article>
                <?php endforeach ?>
            </div><!-- .column-wrapper -->

             <div class="column-wrapper">
                <?php foreach ($get_second_content as $content): ?>
                    <article>
                        <div class="featured-image" style="background-image:url('<?php echo esc_url( get_the_post_thumbnail_url( $content['id'] ) ) ; ?>');">
                        </div><!-- .featured-image -->

                        <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="footer-meta">
                                <?php ostrich_magazine_posted_on( $content['id'] ); ?>
                            </div><!-- .footer-meta -->
                        </div><!-- .entry-container -->
                    </article>
                <?php endforeach ?>
            </div><!-- .column-wrapper -->
        </div><!-- .section-content -->
    </div><!-- .two-column-wrapper -->
</div><!-- .two-column -->