<?php
defined('ABSPATH') || exit;
$cat_opt = '';
$post_id = get_the_ID();
if (get_post_type() == 'post') {
    $categories = get_the_category($post_id);
    $cat_opt = get_term_meta($categories[0]->term_id, 'dej_category_options', true);
}
?>
<div class="post_card_1 item<?= $post_id ?>" style="cursor:pointer" onclick="window.location.href='<?php the_permalink(); ?>'">
    <?php echo '<div class="cat">' . $categories[0]->name . '</div>'; ?>
    <a href="<?php the_permalink(); ?>"><?php if (has_post_thumbnail()) { the_post_thumbnail('medium_large'); } elseif (dej_woo_activated()) { echo wc_placeholder_img();} ?></a>
    <h3 class="title"><a href="<?php the_permalink(); ?>"><?php the_title() ?></a></h3>
</div>
<?php if ($cat_opt && $cat_opt['dej_cat_color']) { ?>
    <style>
        <?= '.post_card_1.item' . $post_id .':hover' ?> {
            border-color: <?= $cat_opt['dej_cat_color'] ?> !important;
        }

        <?= '.post_card_1.item' .  $post_id . ' .cat' ?>  {
            background: <?= $cat_opt['dej_cat_color'] ?> !important;
        }
    </style>

<?php } ?>