<?php

    if ( urbanews_setting('urbanews_enable_featured_posts', true) == true ) :

        $featured_posts_enabled = urbanews_setting('urbanews_enable_featured_posts_only_first_page_pagination', true);

        if (
            (
                $featured_posts_enabled == true && 
                get_query_var('paged') <= 1
            ) ||
            $featured_posts_enabled == false
        ) :

        $featured_posts_additional_css = ( urbanews_setting('urbanews_featured_posts_truncate_post_titles') == true ) ? ' featured-posts-truncate-post-titles' : '';

    ?>

        <section class="featured-posts-section">

            <div class="container">
                
                <div class="row">
                    
                    <div class="col-md-12">

                        <div class="featured-posts-grid <?php echo esc_attr($featured_posts_additional_css);?>">

                            <div class="featured-posts-main-column" >
                                
                                <?php

                                    $section_title = urbanews_setting('urbanews_main_column_label', esc_html__( 'Recent', 'urbanews' ));
                                    $slider_transition = urbanews_setting('urbanews_main_column_slider_transition', 'fade');

                                    $col_cx = array(
                                        'post_type' => 'post',
                                        'posts_per_page' => intval(urbanews_setting('urbanews_main_column_posts_limit', 5)),
                                        'ignore_sticky_posts' => true,
                                        'orderby' => urbanews_setting('urbanews_main_column_posts_orderby', 'date'),
                                        'order' => urbanews_setting('urbanews_main_column_posts_sort_order', 'desc'),
                                    );

                                    if ( is_numeric(urbanews_setting('urbanews_main_column_posts_category')) ) :
                                        $col_cx['cat'] = urbanews_setting('urbanews_main_column_posts_category');
                                    endif;
                            
                                    urbanews_horizontal_featured_posts_slideshow($col_cx, $section_title, $slider_transition);
                                
                                ?>

                            </div>

                            <div class="featured-posts-secondary-column">

                                <?php

                                    $section_title = urbanews_setting('urbanews_secondary_column_label', esc_html__( 'Oldest post', 'urbanews' ));

                                    $col_sx = array(
                                        'post_type' => 'post',
                                        'posts_per_page' => intval(urbanews_setting('urbanews_secondary_column_posts_limit', 8)),
                                        'ignore_sticky_posts' => true,
                                        'orderby' => urbanews_setting('urbanews_secondary_column_posts_orderby', 'date'),
                                        'order' => urbanews_setting('urbanews_secondary_column_posts_sort_order', 'asc'),
                                    );

                                    if ( is_numeric(urbanews_setting('urbanews_secondary_column_posts_category')) ) :
                                        $col_sx['cat'] = urbanews_setting('urbanews_secondary_column_posts_category');
                                    endif;
                                
                                    urbanews_vertical_featured_posts_slideshow($col_sx, $section_title);

                                ?>

                            </div>

                            <div class="featured-posts-side-column">

                                <?php

                                    $section_title = urbanews_setting('urbanews_side_column_label', esc_html__( 'Popular', 'urbanews' ));

                                    $col_dx = array(
                                        'post_type' => 'post',
                                        'posts_per_page' => intval(urbanews_setting('urbanews_side_column_posts_limit', 8)),
                                        'ignore_sticky_posts' => true,
                                        'orderby' => urbanews_setting('urbanews_side_column_posts_orderby', 'comment_count'),
                                        'order' => urbanews_setting('urbanews_side_column_posts_sort_order', 'desc'),
                                    );

                                    if ( is_numeric(urbanews_setting('urbanews_side_column_posts_category')) ) :
                                        $col_dx['cat'] = urbanews_setting('urbanews_side_column_posts_category');
                                    endif;
                                
                                    urbanews_vertical_list_featured_posts_slideshow($col_dx, $section_title);

                                ?>

                            </div>

                        </div>
                    
                    </div>

                </div>

            </div>

        </section>

<?php

        endif;


    endif;

?>