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

// Get the content type.
$featured = get_theme_mod( 'return_blog_featured', 'cat' );
// Bail if the section is disabled.
if ( 'disable' === $featured ) {
    return;
}
$featured_count    = 6 ;

$get_content = return_blog_get_section_content( 'featured', $featured, $featured_count  );
?>
 <div id="featured-post" class="pt padding">
   <div class="container">
        <div class="section-header">
           <?php if (  !empty( get_theme_mod( 'return_blog_featured_title') ) ): ?>
                 <h2 class="section-title"><?php echo esc_html( get_theme_mod( 'return_blog_featured_title') ) ?></h2>
            <?php endif ?>
            <?php if ( !empty( get_theme_mod( 'return_blog_featured_sub_title') ) ): ?>
                <p class="section-subtitle"><?php echo esc_html( get_theme_mod( 'return_blog_featured_sub_title') ) ?></p>
            <?php endif ?>
        </div><!-- .section-header -->

       <div class="col-3">
            <?php foreach ($get_content as $content): ?>
                <article>
                   <div class="post-item">
                       <div class="featured-image" style="background-image:url('<?php echo esc_url( get_the_post_thumbnail_url( $content['id'] ) ) ; ?>')"></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 class="entry-content">
                                <p><?php echo esc_html( wp_trim_words( $content['content'], 30 ) ); ?> <a href="<?php echo esc_url( $content['url'] ) ?>">Read more</a></p>
                            </div>

                            <div class="entry-meta clear">
                                <?php return_blog_post_author() ; ?>

                                <?php return_blog_posted_on( $content['id'] ); ?>                          
                            </div>
                       </div>
                   </div><!--.post-item -->
               </article>
            <?php endforeach ?>
       </div><!--.col-3 -->
   </div><!--.container -->
</div><!--#featured-post -->
    