<div class="anews-mostview-recent-wrapper pt-80">
    <div class="container">
        <div class="row">
            <div class="col-12 col-sm-12-col-md-6 col-lg-8">
                <div class="anews-mostview-section">
                    <div class="section-title"><?php echo esc_html(get_theme_mod( 'anews_home_most_view_Title','Most View' )); ?></div>
                    <div class="row">
                        <?php
                        if( true == get_theme_mod( 'anews_home_mvc_show' ) ) {
                            $p = new \WP_Query( array(
                                'posts_per_page' => 5,
                                'post_type' => 'post',
                                'order' => esc_attr(get_theme_mod( 'anews_home_most_view_order' )),
                                'tax_query' => array(
                                    array(
                                        'taxonomy' => 'category',
                                        'field' => 'term_id',
                                        'terms' => get_theme_mod( 'anews_home_most_view_cat' ),
                                    )
                                ),
                            ));
                        }else{
                            $p = new \WP_Query( array(
                                'posts_per_page' => 5,
                                'post_type' => 'post',
                                'order' => 'DESE',
                            ));
                        }
                            ?>
                        <?php while ( $p->have_posts() ): $p->the_post();
                            $anews_current_index = $p->current_post+1;
                            $anews_cols = ($anews_current_index % 5 == 1) ? 'col-md-12 col-lg-12 full color2' : 'col-md-6 col-lg-6 small-list color4';
                            ?>
                        <div class="col-12 col-sm-12 <?php echo esc_attr($anews_cols); ?>">
                            <div class="anews-hpost-item">
                                <?php if(has_post_thumbnail()) : ?>
                                <div class="hpost-img">
                                    <a href="<?php echo esc_url(the_permalink()); ?>">
                                        <?php the_post_thumbnail('full', array('class' => 'img-responsive')); ?>
                                    </a>
                                </div>
                                <?php endif; ?>
                                <div class="hpost-contents">
                                    <div class="anews-home-post-meta">
                                        <ul>
                                            <?php anews_post_cat(); ?>
                                        </ul>
                                    </div>
                                    <h2><a href="<?php echo esc_url(the_permalink()); ?>"><?php the_title(); ?></a></h2>
                                    <span><?php esc_html_e('By','anews'); ?>
                                        <?php echo esc_html(get_the_author()); ?></span>
                                    <?php if(($anews_current_index % 5 == 1) == 1 ) : ?>
                                    <div class="hpost-item-dec">
                                        <?php echo wp_kses_post( wp_trim_words( get_the_content(), 25 ) ); ?>
                                    </div>
                                    <?php endif; ?>
                                </div>
                            </div>
                        </div>
                        <?php endwhile; wp_reset_query(); ?>
                    </div>
                </div>
            </div>
            <div class="col-12 col-sm-12-col-md-6 col-lg-4">
                <div class="section-title"><?php echo esc_html(get_theme_mod( 'anews_home_most_recent_Title','Recent Post' )); ?></div>
                <div class="anews-recent-post-lists">
                    <?php 
                        if( true == get_theme_mod( 'anews_home_mtr_show' ) ) {
                            $p = new \WP_Query( array( 
                                'posts_per_page' => 4,
                                'post_type' => 'post',
                                'order' => esc_attr(get_theme_mod( 'anews_home_most_recent_order' )),
                                'tax_query' => array(
                                    array(
                                        'taxonomy' => 'category',
                                        'field' => 'term_id',
                                        'terms' => get_theme_mod( 'anews_home_most_recent_cat' ),
                                    )
                                ),
                            ));
                        }else{
                            $p = new \WP_Query( array( 
                                'posts_per_page' => 4,
                                'post_type' => 'post',
                                'order' => 'ASC'
                                
                            ));
                        }
                            while ( $p->have_posts() ): $p->the_post();
                        ?>
                    <div class="anews-hpost-item">
                        <?php if(has_post_thumbnail()) : ?>
                        <div class="hpost-img">
                            <a
                                href="<?php echo esc_url(the_permalink()); ?>"><?php the_post_thumbnail('full', array('class' => 'img-responsive')); ?></a>
                        </div>
                        <?php endif; ?>
                        <div class="hpost-contents">
                            <span><i
                                    class="fas fa-calendar"></i><?php echo esc_html(get_the_date( 'd M, Y', $post->ID )); ?></span>
                            <h2><a href="<?php echo esc_url(the_permalink()); ?>"><?php the_title(); ?></a></h2>
                        </div>
                    </div>
                    <?php endwhile; wp_reset_query(); ?>
                    <?php if( true == get_theme_mod( 'anews_home_most_recent_btn_shw' )) : ?>
                    <a href="<?php echo esc_url(get_theme_mod( 'anews_home_most_recent_btn_link' )); ?>" class="allpost">
                        <?php esc_html_e('View All','anews'); ?> <i class="fas fa-angle-double-right"></i></a>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </div>
</div>