<?php
/*
Theme Designed By: Meysam Hosseinkhani
Email: Meysam98@Gmail.com
Author Website: Hosseinkhani.ir
*/
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
$specialpost = new WP_Query( array(
                   'posts_per_page' => 5,
                   'post_type' => 'download',
                   'post_status' => 'publish',
                   'meta_key' => 'file_spsale',
                   'meta_value' => 1,
                   'order' => 'DESC'  ) );
?>
      <div class="scon">
        <div class="spslider-con">
        <?php if ( $specialpost->have_posts() ) { ?>
        <div class="slide-progress"></div>
         <div class="spslider owl-carousel" data-itemplay="true" data-itemtime="8000">
               <?php while ( $specialpost->have_posts() ) : $specialpost->the_post(); ?>
             <div class="item col-12">
                <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
                <?php if($az_data['square_thumb']) {
                    $spimg = 'col-md-4 col-12';
                    $spdesc = 'col-md-8 col-12';
                } else {
                    $spimg = 'col-md-6 col-12';
                    $spdesc = 'col-md-6 col-12';
                }
                     ?>
                 <div class="<?php echo $spimg; ?> sp-img">
                 <?php p_img(); ?>
             </div>
             <div class="<?php echo $spdesc; ?> sp-desc">
                <div class="col-12 sp-stitle">
                    <span class="sp-red">پیشنهاد</span> شگفت انگیز
                </div>
                <div class="col-12 sp-title">
                     <i class="fas fa-chevron-left" aria-hidden="true"></i><?php the_title(); ?>
                </div>
                <div class="col-12 sp-rprice">
                     <span><?php 
                         $saleprice = edd_format_amount(rwmb_meta( 'file_saleprice', '' , get_the_ID() ));
                         echo '<del>'.$saleprice.' تومان</del>'; 
                     ?></span>
                </div>
                <div class="col-12 sp-sprice">
                     <span><?php 
                    $price = edd_price(get_the_ID(),false);
                    $price = preg_replace("/<([a-z][a-z0-9]*)[^>]*?(\/?)>/i",'<$1$2>', $price);
                    echo $price;
                    ?></span>
                    <span class="sp-discount"><?php echo dis_price(get_the_ID()); ?></span>
                </div>
                <div class="col-12 sp-btn">
                    <div class="btn btn-blue">
                        <i class="fas fa-shopping-cart" aria-hidden="true"></i>
                        خرید محصول
                    </div>
                </div>
             </div>
                 </a>
             </div>
              <?php endwhile; ?>
          </div>
                <?php  } else {echo '<div class="not-found">فایلی با شرایط مورد نظر یافت نشد.</div>';}
                     wp_reset_postdata();
                     ?>
          </div>
      </div>