<?php 
    // get the current taxonomy term
    $category = get_the_category(); 
    $terms = get_the_terms( $post->ID, 'countries' );
    $category_parent_id = $category[0]->category_parent;
	if ( $category_parent_id != 0 ) {
    	$category_parent = get_term( $category_parent_id, 'category' );
    	$slugCat = $category_parent->slug;
		$idCat = $category_parent->term_id;
        $nameCat = $category_parent->name;
	} else {
    	$slugCat = $category[0]->slug;
		$idCat = $category[0]->term_id;
		$nameCat = $category[0]->cat_name;
	}
?>
<article id="post-<?php the_ID(); ?>" class="component-linkarticle medium2">
    <a href="<?php the_permalink(); ?>" class="content-article bg-article-<?php echo $slugCat; ?>-hover">
        <div class="component-thumb medium2 bg-cat-<?php echo $slugCat; ?>">
            <?php if(has_post_thumbnail()): ?>
                <?php the_post_thumbnail( 'thumb-post-medium' ); ?>
            <?php endif; ?>
        </div>
        <header>
            <div class="component-dados">
                <span class="bt-category  bt-cat-<?php echo $slugCat; ?>"><?php echo $nameCat; ?></span>
                <span class="local"><?php echo $terms[0]->name; ?> <span></span></span>
                <span class="data"><?php the_time('M'); ?> <?php the_time('j'); ?>, <?php the_time('Y'); ?></span> 
            </div>        
            <h3 class="h2 link-cat-<?php echo $slugCat; ?>"><?php the_title(); ?></h3>
            <?php the_excerpt(); ?>
        </header>
    </a>
</article>