<?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));
}


?>

    
<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>

<?php if(have_posts()) :?>
<div class="search-card-box">

	<?php while(have_posts()) : the_post();?>
    <?$curr_id = get_the_id()?>
    
	<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?>
		<div><a href="<?the_permalink();?>"><strong><?the_title();?></strong></a></div>
        

        <?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>    
 


<?php endwhile;?> 
		</div>



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


<?else:?>

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

<?php endif;?>


</div>

<?php get_footer(); ?>