<?php
/**
 * The main template file.
 *
 */

get_header( 'pets' );
$nn = 0;
$miniblock_open = false;?>

    

<div id="content">   

<?$current_category = get_queried_object();
$category_id = $current_category->term_id;?>

<ul id="nav_content">
    <?if ($category_id == 14):?>
        <li>Питомцы</li>
    <?else:?>   
        <li><a href="<?=get_home_url()?>/category/pets">Питомцы</a></li>
        <li> - <?single_cat_title()?></li>
    <?endif?>    
</ul>      

<?php if(have_posts()) : while(have_posts()) : the_post();?>

    <?$nn++;?>

    <?if ($nn == 1):?>
      
    <div class="main-card">
        <?if ( has_post_thumbnail() ) :?>
            <div class="card-img-top"> 
                <a href="<?the_permalink();?>"><img class="card-img-top" src="<?php echo get_the_post_thumbnail_url(null, 'full'); ?>" alt="<?the_title();?>">
                    <?if( has_tag( 'видео' ) ):?>
                        <span class="play-card"></span>
                    <?endif?>
                </a>
            </div>    
        <?endif?>
        <h2 class="main-card-title"><a href="<?the_permalink();?>"><?the_title();?></a></h2>
        <div class="main-card-body">
            <div class="main-card-text"><a href="<?the_permalink();?>"><?the_excerpt();?></a></div>
            <div class="news_date"><?the_time('j F Y, G:i');?></div>
        </div>
    </div>


    <?elseif ($nn > 1):?>

        <?if ($nn == 2):?>
            <?$miniblock_open = true;?>
            <div class="mini-card-block">
        <?endif?>

        <div class="mini-card">
        <?if ( has_post_thumbnail() ) :?>
                    <div class="mini-card-img">
                    <?$imgurl = IMGSERVER.'news/512x340/'.str_replace('https://vetandlife.ru/wp-content/uploads/', '', get_the_post_thumbnail_url(null, 'full'))?>    
                        <a href="<?the_permalink();?>"><img class="mini-card-img" src="<?php echo $imgurl; ?>" alt="<?the_title();?>">
                        <?if( has_tag( 'видео' ) ):?>
                            <span class="play-card"></span>
                        <?endif?>
                        </a>
                    </div>
                <?endif?>
             <h2 class="mini-card-title"><a href="<?the_permalink();?>"><?the_title();?></a></h2>
            <div class="mini-card-body">
                <div class="news_date"><?the_time('j F Y, G:i');?></div>
            </div>
        </div>    

    <?endif?>    

<?php endwhile;?> 

    </div> <!--//end minicard block -->

<?else:?>

    Здесь пока нет публикаций

<?php endif;?>

<?get_template_part( '/blocks/paginator');?>

<?if ($miniblock_open):?>
    </div>
<?endif?>    

<?php get_footer( 'pets' ); ?>