<?php             

    $terms = get_the_terms(get_the_ID() , 'product_cat');
    if ($terms && !is_wp_error($terms)):

        $draught_links = array();
        $draught_name = array();

        foreach ($terms as $term)
        {
            $draught_links[] = $term->term_id;
            $draught_name[] = $term->name;

            $termLink = get_term_link($term, 'product_cat');
        }

        $on_draught = join(" ", $draught_links);
        $on_drt = join(" , ", $draught_name);



   $fncyprvewlink = get_post_meta(get_the_ID(), "fncyprvewlink", true);

   $fancydwnlink = get_post_meta(get_the_ID(), "fancydwnlink", true);

   $fncyvidelink = get_post_meta(get_the_ID(), "fncyvidelink", true);

   $fancymetcsleiten = get_post_meta(get_the_ID(), "fancymetcsleiten", true); 

   $select_iconds = get_post_meta(get_the_ID(), "select_iconds", true);
   
   $writeiconclasss = get_post_meta(get_the_ID(), "writeiconclasss", true);
   $rand = wp_rand(213233,13023);
         

?>

        <div  class=" grid-item <?php echo esc_attr($on_draught) . ' ' . esc_attr($layout_class); ?>" style="width:<?php echo esc_attr($grid_layout) ?>%">
        <div id="rerepopup-<?php echo esc_attr($x . $rand_type); ?>" class="image-popup-child white-popup mfp-hide">
           <img src="<?php echo esc_url(fancyfilter_blog_thumbnail()); ?>" alt="<?php echo esc_attr(fancyfilter_pro_alt_text()); ?>">
           <h2 class="fancyfilter_pro-mfg-title" style="color:<?php echo esc_attr($el_pup_t_clr);?>"> <?php echo esc_html(get_the_title()) ?></h2>
           <a href="<?php echo esc_url(get_the_permalink()); ?>" class="fancyfilter_pro_poptilie_link_" style="color: <?php echo esc_attr($el_pup_btn_clr); ?>;background: <?php echo esc_attr($el_pup_btn_bg); ?>;border-radius: <?php echo esc_attr($el_pup_btn_bdr) ?>px; "><?php echo esc_html($el_pup_btn_title) ?></a>
        </div>

        <?php


         if ($grid_style == 'st-free')
        { 

          
            ?>
            <div class="fancyfilter_pro-free-item fancyfilter_pro-free-effect__item <?php echo esc_attr($animation); ?>">

        <img class="fancyfilter_pro-free-item__image" src="<?php echo esc_url(fancyfilter_blog_thumbnail()); ?>"  alt="<?php echo esc_attr(fancyfilter_pro_alt_text()); ?>" >

              <div class="portfolio_content">
                 <?php if ($fancyfilter_pro_hide_cat !== 'checked')
            { ?>
                 <small><?php echo esc_html($on_drt); ?></small> 
                 <?php
            } ?>
           
          <div class="fancyfilter_pro-free-item__info">

            <h2 class="fancyfilter_pro-free-item__header"><?php echo esc_html(fancyfilter_pro_shtcode_title()); ?></h2>

            <div class="fancyfilter_pro-free-item__links">

              <div class="fancyfilter_pro-free-item__link-block">

                <a href="<?php echo esc_url(get_the_permalink(get_the_ID())); ?>" class="fancyfilter_pro_port_link "><?php echo wp_kses_post($link_icon); ?></a>
              </div>

              <div class="fancyfilter_pro-free-item__link-block">

              <?php     include FANCYFILTER_PATH .'includes/extra/FancyPopupDos.php';
                 ?>

              </div>

            </div>
            <?php 

            echo '<p class="fancyfilter_proprice">' . wp_kses_post($product->get_price_html()) . '</p>';
            
                echo '<div class="fancyfilter_product woocommerce fancyfilter_pro_variable">'. do_shortcode('[add_to_cart id="'.get_the_ID().'" show_price="false"]').'</div>';
             ?>
          </div>
          </div>
<?php
          if ($product->is_on_sale())
                {
                    echo '<p class="fancyfilter_pro_on_sale">' . esc_html__('Sale', 'fancy-fiter') . '</p>';
               } ?>
          </div>
        
    <?php } ?>
   


           </div>
<?php
endif;
$x++;
