<?php if( $the_query->have_posts() ): ?>
<?php $count = 0; ?>
<?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<?php
/**
* Получаем главную категорию
**/
$primary_term_id = yoast_get_primary_term_id('category');
$postTerm = get_term( $primary_term_id );
//echo $postTerm->name;
?>
<?php $count++; if ($count == 1) : ?>
<?php array_push($intro_id, get_the_ID()) ?>
<?php if( !is_paged() ): ?>
<div class="intro-preview">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail( array( 496, 400, 'bfi_thumb' => true ), array('alt' => get_the_title(), 'title' => get_the_title()) );
}
?>
<div class="intro-preview-description">
<div class="label-wrap">
<?php foreach (get_the_category() as $category){ ?>
<span class="label"><?php echo $category->cat_name; ?></span>
<?php } ?>
</div>
<div class="text">
<?php the_title(); ?>
</div>
</div>
</a>
</div>
<?php endif; ?>
<?php endif; ?>
<div class="intro-col">
<?php if ($count == 2) : ?>
<?php array_push($intro_id, get_the_ID()) ?>
<?php if( !is_paged() ): ?>
<div class="intro-preview">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail( array( 240, 189, 'bfi_thumb' => true ), array('alt' => get_the_title(), 'title' => get_the_title()) );
}
?>
<div class="intro-preview-description">
<div class="label-wrap">
<span class="label">
<?php echo $postTerm->name; ?>
</span>
</div>
<div class="text">
<?php the_title(); ?>
</div>
</div>
</a>
</div>
<?php endif; ?>
<?php endif; ?>
<?php if ($count == 3) : ?>
<?php array_push($intro_id, get_the_ID()) ?>
<?php if( !is_paged() ): ?>
<div class="intro-preview">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php
if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
the_post_thumbnail( array( 240, 189, 'bfi_thumb' => true ), array('alt' => get_the_title(), 'title' => get_the_title()) );
}
?>
<div class="intro-preview-description">
<div class="label-wrap">
<span class="label">
<?php echo $postTerm->name; ?>
</span>
</div>
<div class="text">
<?php the_title(); ?>
</div>
</div>
</a>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
<?php endwhile; ?>
<?php endif; ?>