<?php
/*
Theme Designed By: S O R O U S H M A R K E T
Email: info@soroushmarket.ir
Demo Website: soroushmarket.ir
Author Website: soroushmarket.ir
*/
 get_header();?>
   <div role="complementary" class="col-lg-3 col-md-3 col-sm-12 hidden-sm hidden-xs side-bar">
   <?php get_template_part('right-sidebar'); ?>
   </div>
<div class="col-lg-9 col-md-9 col-sm-12 col-xs-12">
   <?php if ( have_posts() ) : ?>
   <?php while ( have_posts() ) : the_post(); ?>
   <div role="main" class="col-xs-12 scon" id="post-<?php the_ID(); ?>">
      <div class="product">
         <div class="row post-row">
            <h2 class="post-title"><span class="fa fa-pencil-square-o" style="width:25px"></span>
               <?php the_title(); ?>
            </h2>
         </div>
         <div class="col-xs-12 post-con">
            <?php the_content(); ?>
         </div>
         <div class="col-xs-12 details">
            <?php if ($data['social_share'] == 1) { ?>
            <div class="col-xs-12 alert alert-success share-box">
            <strong><span class="fa fa-bullhorn"></span>&nbsp;اشتراک گذاری در شبکه های اجتماعی، به دوستانتان معرفی کنید.</strong>
               <ul class="social">
                        <li><a aria-hidden="true" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="فیسبوک" href="http://www.facebook.com/sharer.php?u=<?php the_permalink(); ?>" target="_blank" class="fa fa-facebook"></a></li>
                        <li><a aria-hidden="true" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="گوگل پلاس" href="https://plus.google.com/share?url=<?php the_permalink(); ?>" target="_blank" class="fa fa-google-plus"></a></li>
                        <li><a aria-hidden="true" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="توئیتر" href="http://www.twitter.com/share?url=<?php the_permalink(); ?>" target="_blank" class="fa fa-twitter"></a></li>
                        <li><a aria-hidden="true" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="لینکداین" href="http://www.linkedin.com/shareArticle?mini=true&url=<?php the_permalink(); ?>" target="_blank" class="fa fa-linkedin"></a></li>
                        <li><a aria-hidden="true" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="کلوب" href="http://www.cloob.com/share/link/add?url=<?php the_permalink(); ?>" target="_blank" class="ico-cloob"></a></li>
                        <li><a aria-hidden="true" data-toggle="tooltip" data-placement="bottom" title="" data-original-title="تلگرام" href="https://telegram.me/share/url?url=<?php the_permalink(); ?>" target="_blank" class="ico-telegram"></a></li>
               </ul>
            </div>
            <?php } ?>
            <div class="col-sm-3 col-xs-12 pattr"><i class="col-xs-2 fa fa-user po-picon"></i><span class="col-xs-10" lang="fa" dir="rtl"><?php the_author(); ?></span></div>
            <div class="col-sm-3 col-xs-12 pattr"><i class="col-xs-2 fa fa-calendar po-picon"></i><span class="col-xs-10"><?php echo get_the_date('j F Y'); ?></span></div>
            <div class="col-sm-3 col-xs-12 pattr"><i class="col-xs-2 fa fa-folder-open-o po-picon"></i><span class="col-xs-10"><?php the_category( '، ' ); ?></span></div>
            <div class="col-sm-3 col-xs-12 pattr"><i class="col-xs-2 fa fa-eye po-picon"></i><span class="col-xs-10" lang="fa" dir="rtl"><?php setPostViews(get_the_ID()); ?><?php echo getPostViews(get_the_ID()); ?></span></div>
         </div>
         <?php if ($data['show_post_tags'] == 1 && has_tag()) { ?>
         <div class="col-xs-12 p-tags">
            <p><?php the_tags('<span class="fa fa-tags"></span>&nbsp;برچسب ها:&nbsp;', '&nbsp;', ''); ?></p>
         </div>
         <?php } ?>
      </div>
   </div>

    <?php if ($data['show_related'] == 1) { ?>
   <!-- begin custom related loop, isa -->
         <?php
            if($data['related_by']=='download_tag'){$related = 'post_tag';}
            elseif ($data['related_by']=='download_category') {$related = 'category';}

            $custom_taxterms = wp_get_object_terms( $post->ID, $related, array('fields' => 'ids') );
            $args = array(
            'post_type' => 'post',
            'post_status' => 'publish',
            'posts_per_page' => 4,
            'orderby' => 'rand',
            'tax_query' => array(
                array(
                    'taxonomy' => $related,
                    'field' => 'id',
                    'terms' => $custom_taxterms
                )
            ),
            'post__not_in' => array ($post->ID),
            );
            $related_items = new WP_Query( $args );
            // loop over query
            if ($related_items->have_posts()) {
               ?>
             <div class="col-xs-12 rcon">
      <div class="product">
         <div class="row prod-name">
            <h4 class="post-title"><span class="fa fa-file-text-o" style="width:30px"></span>مطالب مشابه</h4>
         </div>
            <?php while ( $related_items->have_posts() ) : $related_items->the_post();
            ?>
         <div class="col-sm-3 col-xs-6 rcol">
            <div class="r-box r-box-view">
               <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
                  <div class="figure">
                     <?php if ( has_post_thumbnail()) :  ?>
                     <?php the_post_thumbnail('thumbnail');?>
                     <?php else: ?>
                     <img src="<?php echo esc_url( get_template_directory_uri() ); ?>/images/tumb.png" class="post-tumb" />
                     <?php endif; ?>
                     <div class="figcaption">
                        <?php the_title(); ?>
                     </div>
                  </div>
               </a>
            </div>
         </div>
         <?php
            endwhile;
            // Reset Post Data
            wp_reset_postdata();
            ?>
      </div>
   </div>
   <!-- end custom related loop, isa --><?php }} ?>

   <?php endwhile; ?>
   <div class="col-xs-12 comments-list">
      <?php comments_template(); ?>
   </div>
   <?php endif; ?>
</div>
</div>
 <?php if ($data['show_side_mobile'] == 1) { ?>
 <div role="complementary" class="col-lg-3 col-md-3 col-sm-12 col-xs-12 visible-sm visible-xs side-bar">
   <?php get_template_part('right-sidebar'); ?>
 </div>
 <?php } ?>
</div>
<?php get_footer(); ?>