<section id="sectionCategory">
    <div class="container">
        <hr class="lineCat border-cat-<?php echo $slug; ?>">
        <header class="sectioncontentTitle">
            <h2 class="sectiontitle border-cat-<?php echo $slug; ?> color-cat-<?php echo $slug; ?>"><?php echo $name; ?></h2>
            <a href="<?php echo esc_url( $category_link ); ?>" style="opacity: 1;" class="bt-all color-cat-<?php echo $slug; ?>">View all <span><?php echo $name; ?></span></a>
        </header>
        <div class="line featured">
            <?php if( have_rows($slug) ): ?>
                <?php while( have_rows($slug) ): the_row(); 
                    $IDpost = get_sub_field('post');
                    $link = get_permalink($IDpost);
                    $terms = get_the_terms( $IDpost, 'countries' );
                    $image = get_the_post_thumbnail_url($IDpost, 'thumb-post-medium');
                    array_push($featuredsID, $IDpost);
                ?>
                    <article class="component-linkarticle medium">
                        <a href="<?php echo $link; ?>" class="component-thumb medium bg-cat-<?php echo $slug; ?>">
                            <?php if($image): ?><img src="<?php echo $image; ?>" alt="<?php echo get_the_title($IDpost) ?>"><?php endif; ?>
                        </a>
                        <header>
                            <div class="component-dados">
                                <a href="<?php echo esc_url( $category_link ); ?>" class="category color-cat-<?php echo $slug; ?>"><?php echo $name; ?> <span class="bg-cat-<?php echo $slug; ?>"></span></a>
                                <span class="local"><?php echo $terms[0]->name; ?></span>
                                <span>|</span>
                                <span class="data"> <?php echo get_the_time('M', $IDpost); ?>  <?php echo get_the_time('j', $IDpost); ?> ,  <?php echo get_the_time('Y', $IDpost); ?></span>
                            </div>
                            <h3 class="h2"><a href="<?php echo $link; ?>" class="link-cat-<?php echo $slug; ?>"><?php echo countText(get_the_title($IDpost), 66); ?></a></h3>
                        </header>
                    </article>
                <?php $cont++; endwhile; ?>
            <?php endif; ?>
            <?php
				$args = array(
					'post_type' => 'post',
					'cat' => $category_id,
					'post__not_in' => $featuredsID,
					'post_status' => 'publish',
					'posts_per_page' => 4
				);
				// The Query
				$the_query = new WP_Query( $args );
				
				// The Loop
				if ( $the_query->have_posts() ):
            ?>
                    <div class="more-featured">
                        <?php	
                            while ( $the_query->have_posts() ) {
                                $the_query->the_post();
                                $newIds = get_the_ID();
                                array_push($featuredsID, $newIds);
                        ?>
                            <?php include 'linkarticle-small.php' ?>
                            
                        <?php	} ?>
                    </div>
            <?php 
				endif;
				/* Restore original Post Data */
				wp_reset_postdata();
			?>
        </div>
        <?php
            $args = array(
                'post_type' => 'post',
                'cat' => $category_id,
                'post__not_in' => $featuredsID,
                'post_status' => 'publish',
                'posts_per_page' => 6
            );
            // The Query
            $the_query = new WP_Query( $args );
            
            // The Loop
            if ( $the_query->have_posts() ):
        ?>
                <a href="#" class="bt-seeMore hideDesktop"><span>See More</span></a>
                <hr class="lineNormal">
                <div class="line linemore hideMobile">
                    <?php	
                        while ( $the_query->have_posts() ) {
                            $the_query->the_post();
                            $newIds = get_the_ID();
                    ?>
                        <?php include 'linkarticle-small.php' ?>
                        
                    <?php	} ?>
                </div>
            </div>
        <?php 
            endif;
            /* Restore original Post Data */
            wp_reset_postdata();
        ?>
    </div>
</section><!-- <?php echo $name; ?> -->