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


get_header();
$nn = 0;
$ids = [];

$votes_file = '/vhosts/beta/wp-content/themes/vij/golos.json';

if (file_exists($votes_file)){
    $votes = json_decode(file_get_contents($votes_file, true));
}

?>

<?

$category = get_queried_object();
$current_cat_id = $category->term_id;

$part_args = [
    'category__in'  => $current_cat_id,
    'posts_per_page' => 23,
    'paged' => $paged

];

$part_query = new WP_Query( $part_args );


?>
    
<div id="content">   
    

<ul id="nav_content">
    <li><a href="https://vetandlife.ru">Главная</li>
    <li> - <?single_cat_title()?></li>
</ul>      

<h1 class="my-4"><?=single_cat_title()?></h1>

<? if($part_query->have_posts()) :?>
    
    <?while( $part_query->have_posts() ) : 
       
       $part_query->the_post();?> 

        <div class="search-card">
        
            <div class="search-card-title"><a href="<?the_permalink();?>"><?the_title();?></a></div>
		    <?if ( has_post_thumbnail() ) :?>
                <a href="<?the_permalink();?>">
                    <img class="search-card-img" src="<?php echo get_the_post_thumbnail_url(null, 'full'); ?>" width="180" alt="<?the_title();?>">
                </a>    
            <?endif?>
		    
            <?if (isset($_COOKIE["vec_$curr_id"])):?>
                <p>Спасибо за Ваш голос</p>
            <?endif?>    
        
            <!--
            <div id="count-<?=$ID?>" style="margin-top: 12px;">
                <i class="far fa-thumbs-up"></i> <?=$votes->$curr_id?>
            </div> -->
     

            <div class="mini-card-body">
                <div class="news_date"></div>
            </div>

        </div>
      
    <?endwhile;?>

<?endif?>

<?$GLOBALS['wp_query']->max_num_pages = $part_query->max_num_pages?>

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


<?wp_reset_postdata();?>


</div>

<?php get_footer(); ?>