<div class="anews-category-post-wrapper pt-80">
        <div class="container">
            <?php 
            if( true == get_theme_mod( 'anews_home_scat_show' ) ){
                $p = new \WP_Query( array( 
                    'posts_per_page' => 7,
                    'post_type' => 'post',
                    'order' => esc_attr(get_theme_mod( 'anews_home_scat_order' )),
                    'tax_query'      => array(
                        array(
                            'taxonomy' => 'category',
                            'terms'    => get_theme_mod( 'anews_home_scat_select' ),
                            'field' => 'term_id',
                        )
                    )
                ));
            }else{
                $p = new \WP_Query( array( 
                    'posts_per_page' => 7,
                    'post_type' => 'post',
                    'order' => 'ASC',
                ));
            }
           $anews_scategorys = get_theme_mod( 'anews_home_scat_select' );
            ?>
            <div class="anews-post-cat-menu">
                <div class="cat-title"><?php echo esc_html(get_theme_mod( 'anews_home_categroy_title','Category' )); ?></div>
                <?php if( true == get_theme_mod( 'anews_home_scat_show' ) ) : ?>
                    <div class="category-menu">
                        <ul>
                            <li class="active" data-filter="*"><?php esc_html_e('Show All','anews'); ?></li>
                            <?php foreach($anews_scategorys as $anews_hpost_cat){
                            $cat_info = get_term($anews_hpost_cat, 'category');
                            echo '<li data-filter=".'.esc_attr($cat_info->slug).'">'.esc_html($cat_info->name).'</li>';
                        }?>
                        </ul>
                    </div>
                <?php else : ?>
                    <?php 
                    $args = array(
                        'orderby' => 'name',
                        'order' => 'ASC',
                        'parent' => 0
                    );
                    $anews_hpost_cats = get_categories($args);
                    if( !empty($anews_hpost_cats) && ! is_wp_error( $anews_hpost_cats ) ) : 
                    ?>
                    <div class="category-menu">
                        <ul>
                            <li class="active" data-filter="*"><?php esc_html_e('Show All','anews'); ?></li>
                            <?php foreach($anews_hpost_cats as $anews_hpost_cat){
                            echo '<li data-filter=".'.esc_attr($anews_hpost_cat->slug).'">'.esc_html($anews_hpost_cat->name).'</li>';
                        }?>
                        </ul>
                    </div>
                <?php endif; endif; ?>
            </div>
            <div class="row anews-hcat-list">
                <?php
                    while ( $p->have_posts() ): $p->the_post();
                    $anews_current_index = $p->current_post+1;
                    $anews_cols = ($anews_current_index % 7 == 1) ? '6 cfull color2 ' : '3 small-list color4 ';
                    $anews_pcat_catagory = get_the_terms( get_the_ID(), 'category' );
					if ( $anews_pcat_catagory && ! is_wp_error( $anews_pcat_catagory ) ) {
						$anews_pcat_cat_list = array();
						foreach ( $anews_pcat_catagory as $anews_pcat_cat ) {
							$anews_pcat_cat_list[] = $anews_pcat_cat->slug;
						}
						$anews_pcat_catshow = join( " ", $anews_pcat_cat_list );
						
					}else{
						$anews_pcat_catshow = '';
					}
                ?>
                <div
                    class="col-12 col-sm-12-col-md-6 col-lg-<?php echo esc_attr($anews_cols . $anews_pcat_catshow); ?>">
                    <div class="anews-category-post-items">
                        <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 % 7 == 1) == 1 ) : ?>
                                <div class="cpost-item-date">
                                    <span><?php echo esc_html(get_the_date( 'd M, Y', $post->ID )); ?></span>
                                </div>
                                <?php endif; ?>
                            </div>
                        </div>
                    </div>
                </div>
                <?php endwhile; wp_reset_query(); ?>
            </div>
        </div>
    </div>