<?php get_header(); ?>
<?php if($qaleb['singl-link-ac']=='1'){?>
<div id="myModal" class="modal">
  <!-- Modal content -->
  <div class="modal-content">
<div class="close">&times;</div>
<h2>لینک کوتاه<h2>	
<h3>لـیـنـک زیـر را کـپـی کـنـیـد !</h3>		
<h4><?php echo wp_get_shortlink(); ?></h4>
</div>
</div>
<?php } ?>

<?php global $qaleb;?>

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php setPostViews(get_the_ID());?>

<div class="container">
<div class="wrapper">
<div class="ap-single">
<div class="single-main">
<?php if($qaleb['p-t']=='1'){?><div class="jmb_banner"><?php echo $qaleb['p-t-h'];?></div><?php } ?>
<div class="post-entry">
<div class="post-content">

<div class="post-header">
<div class="breadcrumb"><div class="nhi"><a href="<?php bloginfo('url'); ?>">صفحه نخست </a> <span class="arrow button-next"></span> <?php the_category(' / ' ); ?></div>
<?php if($qaleb['singl-date-ac']=='1'){?><li><span>انتشار : </span><?php the_date('');  ?> - <?php the_time('');  ?></li><?php } ?>
<?php if($qaleb['singl-category-ac']=='1'){?><li><span>کد خبر : </span> <?php the_ID();?></li><?php } ?>
<?php if($qaleb['singl-view-ac']=='1'){?><li><span>مشاهده : </span><?php echo getPostViews (get_the_ID()); ?></li><?php } ?>
</div>
<?php if($qaleb['rotitr']=='1'){?><?php if(get_post_meta( get_the_ID(), 'meta-text-1', true )!=null){ ?><div class="roti"><?php echo get_post_meta( get_the_ID(), 'meta-text-1', true ); ?></div><?php } ?><?php } ?>
<h1 class="post-title"> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h1>
<?php if($qaleb['lide']=='1'){?><div class="lead"><?php if(get_meta('lead') != false) : echo get_meta('lead'); else : the_excerpt(); endif; ?></div><?php } ?>

<?php if($qaleb['singl-thumb-bg']=='1'){?>
<div class="post-media">
<div class="thumbnail">
<?php if(has_post_thumbnail()){?>
<a href="<?php the_permalink(); ?>"><img src="<?php the_post_thumbnail_url('loop-4'); ?>"></a>
<?php }else{ ?>
<img src="<?php bloginfo("template_url"); ?>/img/none.png">
<?php } ?>
</div>
 </div>
 <?php } ?>
 </div>

<div class="entry">
<?php if($qaleb['singl-thumb-sm']=='1'){?>
<div class="thumbnail-small">
<?php if(has_post_thumbnail()){?>
<a href="<?php the_permalink(); ?>"><img src="<?php the_post_thumbnail_url('loop-2'); ?>"></a>
<?php }else{ ?>
<img src="<?php bloginfo("template_url"); ?>/img/none.png">
<?php } ?>
</div>
<?php } ?>

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

<div class="post-info">
<?php if($qaleb['singl-user-ac']=='1'){?><li><i class="fa fa-user" aria-hidden="true"></i><span>ارسال : </span><?php the_author_posts_link(); ?></li><?php } ?>
<?php if(get_post_meta( get_the_ID(), 'meta-text-3', true )!=null){ ?><li><i class="fa fa-pencil" aria-hidden="true"></i><span> نویسنده : </span><?php echo get_post_meta( get_the_ID(), 'meta-text-3', true ); ?> </li><?php } ?>
<?php if(get_post_meta( get_the_ID(), 'meta-text-4', true )!=null){ ?><li><i class="fa fa-question-circle-o" aria-hidden="true"></i><span> منبع : </span><?php echo get_post_meta( get_the_ID(), 'meta-text-4', true ); ?></li><?php } ?>

</div>

<?php if($qaleb['singl-tags-ac']=='1'){?>
<div class="tags-links"><div class="im-tag-title clearfix"><i class="fa fa-tags"></i>برچسب ها</div>
<div class="im-tag-items">
<?php the_tags('',' '); ?><?php if(has_tag()){ echo ' '; }else { echo '<p style="font:12px Num_Light">این مطلب بدون برچسب می باشد.</p>';}?>
</div></div>
<?php } ?>
</div>

<div class="post-controll">
<div class="inn">
<div class="post-share">
<ul>
<?php if($qaleb['single-social-ac']=='1'){?>
<li><a target="_blank" href="http://www.facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?>"><i class="fa fa-facebook"></i></a></li>
<li><a target="_blank" href="http://twitter.com/home?status=<?php the_permalink(); ?>"><i class="fa fa-twitter"></i></a></li>
<li><a target="_blank" href="https://www.linkedin.com/shareArticle?mini=true&amp;url=<?php the_permalink() ?>"><i class="fa fa-linkedin"></i></a></li>
<li><a target="_blank" href="https://telegram.me/share/url?url=<?php the_permalink(); ?>"><i class="fa fa-send-o"></i></a></li>
<li><a target="_blank" href="https://wa.me/?text=<?php the_permalink(); ?>"><i class="fa fa-whatsapp"></i></a></li>
<?php } ?>
</ul>
</div>
<div class="post-icons">
<ul>
<?php if($qaleb['single-font-ac']=='1'){?>
<li class="font-size-control plus" title="بزرگنمایی" data-action="increase"><i class="fa fa-font" aria-hidden="true"></i></li>
<li class="font-size-control" title="کوچکنمایی" data-action="decrease"><i class="fa fa-font" aria-hidden="true"></i></li>
<?php } ?>
<?php if($qaleb['print']=='1'){?><li><a class="print" href="#" onclick='window.open("<?php the_permalink();?>?print=1", "printwin","left=200,top=200,width=820,height=550,toolbar=1,resizable=0,status=0,scrollbars=1");'><i class="fa fa-print"></i></a></li><?php } ?>
<?php if($qaleb['singl-link-ac']=='1'){?><li><a id="myBtn"><i class="fa fa-link" aria-hidden="true"></i></a></li><?php } ?>
<?php if($qaleb['send']=='1'){?><li><i class="fa fa-envelope-o" aria-hidden="true"><?php echo direct_email('') ?></i></li><?php } ?>
</ul>
</div>
</div>
</div>

</div>
<?php if($qaleb['relate-default']=='1'){?>
<?php if($qaleb['norm-or-tage'] == '1'){?>
<?php get_template_part('inc/item/relat-norm'); ?>
<?php }else{ ?>
<?php get_template_part('inc/item/relat-tage'); ?>
<?php } ?>
<?php } ?>
<?php if($qaleb['p-b']=='1'){?><div class="jmb_banner"><?php echo $qaleb['p-b-h'];?></div><?php } ?>
<div id="comments" class="comments-area">
<div class="ttit"><h3>ارسال دیدگاه</h3>
<?php if($qaleb['comments-1'] == '1'){?><b><?php $comments_count = wp_count_comments(get_the_ID()); echo "مجموع دیدگاهها : " . $comments_count->total_comments; ?></b><?php } ?>
<?php if($qaleb['comments-2'] == '1'){?><b><?php $comments_count = wp_count_comments(get_the_ID()); echo "در انتظار بررسی : " . $comments_count->moderated; ?></b><?php } ?>
<?php if($qaleb['comments-3'] == '1'){?><b>انتشار یافته : <?php comments_number('0', '1', '%' );?></b><?php } ?>
</div>
<?php comments_template(); ?>
</div>
</div>
<div class="single-sidebar sidebar">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('index-post') ) : ?><?php endif; ?>
</div>
</div>
</div>
</div>
<?php endwhile; else : endif; ?>
<?php get_footer(); ?>