<?php
/**
 * Template part for displaying front page latest news.
 *
 * @package Shadow Themes
 */

// Get default  mods value.
$featured_post_enable = get_theme_mod( 'nuevo_blog_featured_post_section_enable', true );
$post_title_size = get_theme_mod( 'nuevo_blog_featured_post_title_font_size');

if ( false == $featured_post_enable ) {
    return;
}
$default = nuevo_blog_get_default_mods();
$featured_post_num = get_theme_mod( 'nuevo_blog_featured_post_num', 3 );
$featured_post_title = get_theme_mod( 'nuevo_blog_featured_post_title');
$section_title_size = get_theme_mod( 'nuevo_blog_featured_post_section_title_font_size');
$featured_post = get_theme_mod( 'nuevo_blog_featured_post_content_type', 'custom' );

$default = nuevo_blog_get_default_mods();

?>
<div id="featured-posts" class="page-section" >
    <div class="wrapper">
        <div class="shadow-section-content column-3 ?>">
            <?php
                $featured_post_cat_id = get_theme_mod( 'nuevo_blog_featured_post_cat' );
                $args = array(
                    'cat' => $featured_post_cat_id,   
                    'posts_per_page' => 3,
                    'ignore_sticky_posts' => true,
                );

                    $query = new WP_Query( $args );

                    $i = 1;
                    if ( $query->have_posts() ) :
                        while ( $query->have_posts() ) :
                            $query->the_post();
                            ?>
                            
                            <article>
                                <div class="featured-item-wrapper" style="background-image: url('<?php the_post_thumbnail_url( 'full' ); ?>');">                    
                                    <div class="shadow-entry-container">
                                        <header class="shadow-entry-header">
                                            <h2 class="shadow-entry-title" style="font-size: <?php echo esc_attr($post_title_size); ?>px;"><a href="<?php the_permalink();?>" class="post-title"><?php the_title();?></a></h2>
                                        </header>
                                    </div><!-- .shadow-entry-container -->
                                </div><!-- .course-item-wrapper -->
                            </article>

                        <?php 
                        $i++;
                        endwhile;
                    endif; 
                    wp_reset_postdata();
                 ?>
        </div><!-- .latest-items-wrapper -->
    </div><!-- .wrapper -->
</div><!-- #latest-news -->
