<?php
/**
 *Latest News Section
*/
    if(get_theme_mod('the_angle_galery_section','no') == 'yes'):
        $latest_news_cat = esc_attr(get_theme_mod('the_angle_gallery_section_category',''));
        $latest_news_title = get_theme_mod('the_angle_gallery_title',esc_html__('Gallery','the-angle'));
         if($latest_news_cat):
            $i=0;
            $args_query = new WP_Query(array('post_type' => 'post', 'posts_per_page' =>6, 'category_name' => $latest_news_cat));
            if ($args_query->have_posts()) :?>
                 <section id="latest-news-section" class="thumbnail-gallery">
                       <div class="tc-container">
                            <div class="title-wrp">
                                <h2 class="section-title"><?php echo esc_html($latest_news_title);?></h2>
                            </div>
                        </div>
                           <div class="gallery">
                                    <?php
                                       while ($args_query->have_posts()):
                                        $args_query->the_post();
                                        $latest_news_slider_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'the-angle-news-thumb');
                                         $i++;
                                                ?>
                                            <div class="gallery-single <?php if($i%4==0){echo " nomargin";} ?> ">
                                                    <div class="cat-caption">

                                                        <?php if(has_post_thumbnail()): ?>

                                                                <a href="<?php echo esc_url($latest_news_slider_image[0]);?>" data-fancybox="Gallery">
                                                                    <img src="<?php echo esc_url($latest_news_slider_image[0]); ?>" alt="<?php the_title_attribute(); ?>" />
                                                                    <div class="g-button">
                                                                        <i class="fa fa-search-plus"></i>
                                                                    </div>
                                                                </a>
                                                        <?php endif; ?>

                                                    </div>
                                             </div>
                                          <?php
                                         endwhile;
                                      wp_reset_postdata();
                                     ?>
                                </div>
                 </section>
                 <?php
             endif;
        endif;
    endif
        ?>
