<?php get_header(); ?>
<div class="container">
  <div class="single-content">
    <?php
    if ( have_posts() ) :
        while ( have_posts() ) : the_post(); ?>
        <?php gt_set_post_view(); ?>
    <article class="single-title">
    <div class="box-shadow">
      <header>
        <h1><?php the_title(); ?></h1>
        <div class="single-post-meta">
          <i class="fas fa-clock"></i>
          <span><?php the_time('d F Y'); ?></span>
        </div>
        <div class="single-post-meta">
          <i class="fas fa-user"></i>
          <span><?php the_author(); ?></span>
        </div>
        <div class="single-post-meta">
          <i class="fas fa-folder-open"></i>
          <span><?php the_category(' , '); ?></span>
        </div>
        <div class="single-post-meta">
          <i class="fas fa-eye"></i>
          <span><?= gt_get_post_view(); ?></span>
        </div>
      </header>
      <div class="single-post-thumbnail">
        <figure>
          <?php the_post_thumbnail(); ?>
        </figure>
      </div>
      <span class="single-study-duration">
        <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16" height="16" viewBox="0 0 16 16">
            <defs><clipPath id="clip-path_fea_5451_stu_5451"><rect id="Rectangle_fea_5451_su__5451" data-name="Rectangle_fea_5451_su__5451" width="16" height="16" fill="#fff" stroke="#16181c" stroke-width="1"></rect></clipPath></defs>
            <g id="Mask_Group_138" data-name="Mask Group 138" clip-path_fea_5451="url(#clip-path_fea_5451_stu_5451)"><g id="Book" transform="translate(0.93 0.558)"><path id="Path_12902" data-name="Path 12902" d="M1.488,14.414V3.349a1.86,1.86,0,0,1,1.86-1.86H13.767a1.86,1.86,0,0,1,1.86,1.86v8.029a1.86,1.86,0,0,1-1.86,1.86H3.055a1.567,1.567,0,0,0-1.567,1.567h0a1.567,1.567,0,0,0,1.567,1.567h8.5a1.861,1.861,0,0,0,1.81-1.431l.4-1.7" transform="translate(-1.488 -1.488)" fill="none" stroke="#16181c" stroke-linecap="round" stroke-width="1.116"></path>
                    <path id="Path_12903" data-name="Path 12903" d="M4.465,1.488V12.651" transform="translate(-1.488 -1.488)" fill="none" stroke="#f38b24" stroke-linecap="round" stroke-width="1.116"></path></g></g>
        </svg>
      زمان مطالعه : <?php echo do_shortcode("[studyduration]");?></span>
      <div class="post-content">
        <?php the_content(); ?>
      </div>
    </div>
    </article>
    <?php
    endwhile;
endif;
?>

<?php 
$prefix = 'prefix_mihancode';
$download_box_content = get_post_meta(get_the_ID(), $prefix . 'download_box_content', true);
$link_title_1 = get_post_meta(get_the_ID(), $prefix . 'link_title_1', true);
if ( !empty($download_box_content || $link_title_1 ) ) : ?>
    <?php get_template_part( '/template/single-post/download-box' ); ?>
<?php endif; ?>

<?php if ($parsa_opt['share_blog']) { ?>
<div class="box-shadow">
<div class="social-share-box">
      <span class="title">اشتراک گذاری </span>
        <a target="_blank" href="https://twitter.com/intent/tweet?text=<?php echo get_permalink(); ?>" rel="nofollow" class="twitter-share-button">
            <i class="fab fa-twitter"></i>
        </a>
        <a target="_blank" href="https://www.linkedin.com/shareArticle?mini=true&url=<?php echo get_permalink(); ?>" rel="nofollow" class="linkedin-share-button">
            <i class="fab fa-linkedin"></i>
        </a>
        <a target="_blank" href="https://pinterest.com/pin/create/button/?url=<?php echo get_permalink(); ?>" rel="nofollow" class="pinterest-share-button">
            <i class="fab fa-pinterest"></i>
        </a>
        <a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=<?php echo get_permalink(); ?>" rel="nofollow" class="facebook-share-button">
            <i class="fab fa-facebook"></i>
        </a>
        <a target="_blank" href="https://telegram.me/share/url?url=<?php echo get_permalink(); ?>" rel="nofollow" class="telegram-share-button">
            <i class="fab fa-telegram"></i>
        </a>
</div>
</div>
<?php } ?>

<?php if ($parsa_opt['author_blog']) { ?>
<div class="box-shadow">
<div class="author-box">
    <?php
    echo get_avatar( get_the_author_meta( 'ID' ), 80 ); ?>
    <div class="post-author-name"> <?php the_author_posts_link(); ?></div>
    <div class="author-desc"><?php the_author_meta( 'description'); ?></div>

</div>
</div>
<?php } ?>

<?php if ($parsa_opt['active_related_post']) : ?>
<div class="box-shadow">
<section class="ralated-posts">
  <div class="ralated-title">
    <i class="fa fa-folder"></i>
    <h3>مطالب مرتبط را از دست ندهید</h3>
  </div>
  <div class="post-slider">
    <div id="relatedpost" class="owl-carousel owl-theme owl-rtl">
      <?php
      $related = get_posts( array(
         'category__in' => wp_get_post_categories($post->ID),
         'numberposts' => 5,
         'post__not_in' => array($post->ID) ) );
      if( $related ) foreach( $related as $post ) {
        setup_postdata($post); ?>
        <?php
        global $parsa_opt;
          $post_blog_template = $parsa_opt['related_post_style'];
           get_template_part( "template/posts-style/$post_blog_template" );
        ?>
    <?php }
    wp_reset_postdata(); ?>
    </div>
  </div>
</section>
</div>
<?php endif; ?>
  <div class="box-shadow">
  <div class="post-comments">
    <?php
    if ( comments_open() || get_comments_number() ) :
    comments_template();
    endif;
    ?>
  </div>
  </div>
  </div>

<?php
if ($parsa_opt['position_sidebar']!='none') {
      get_sidebar();
      if ($parsa_opt['position_sidebar']=='right') {
          ?>
          <style>
              .single-sidebar {float: right !important;}
              .single-content {float: left !important;}
          </style>
          <?php
      }
  }
  else {
      ?>
      <style>
          .single-content {width: 100% !important;}
      </style>
      <?php } ?>

</div>
<?php get_footer(); ?>
