<div class="medd">
<?php get_header(); ?>
<style>button, html input[type="button"], input[type="reset"], input[type="submit"] { display: inline-block; height: auto; line-height: auto; width: auto; border-radius: none; color:#e2e2e2; font-family: Num_Medium; text-shadow: none; background: none; transition: all .6s ease; box-shadow: none; font-size: 12px; opacity:none;margin: none; }</style>
<?php while(have_posts()) : the_post(); ?>
<div id="post-media">
<div class="container">
<div id="post-media-balans">
<div class="cmdark_title"><b><?php the_title(); ?></b>
<div class="ico">
<?php if(get_post_meta( get_the_ID(), 'meta-text-6', true )!=null){ ?><span class="ico"> عکاس : <?php echo get_post_meta( get_the_ID(), 'meta-text-6', true ); ?></span>    | <?php } ?>
<?php if($qaleb['singl-category-ac']=='1'){?><span class="ico">  شناسه خبر : <?php the_ID();?></span>    | <?php } ?>
<?php if($qaleb['singl-date-ac']=='1'){?> <span class="ico">تاریخ انتشار : <?php the_time(' d F Y  -  G:i');  ?></span>    | <?php } ?>
<?php if($qaleb['singl-view-ac']=='1'){?><span class="ico"> <?php set_post_views (get_the_ID()); ?><?php echo get_post_views (get_the_ID()); ?></span> <?php } ?>
</div>
</div>
<div id="lin-10"></div>
<?php
add_filter('post_gallery', 'my_post_gallery', 10, 2);
function my_post_gallery($output, $attr) {
global $post;

if (isset($attr['orderby'])) {
$attr['orderby'] = sanitize_sql_orderby($attr['orderby']);
if (!$attr['orderby'])
unset($attr['orderby']);
}

extract(shortcode_atts(array(
'order' => 'ASC',
'orderby' => 'menu_order ID',
'id' => $post->ID,
'itemtag' => 'dl',
'icontag' => 'dt',
'captiontag' => 'dd',
'columns' => 3,
'size' => 'thumbnail',
'include' => '',
'exclude' => ''
), $attr));

$id = intval($id);
if ('RAND' == $order) $orderby = 'none';

if (!empty($include)) {
$include = preg_replace('/[^0-9,]+/', '', $include);
$_attachments = get_posts(array('include' => $include, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $order, 'orderby' => $orderby));

$attachments = array();
foreach ($_attachments as $key => $val) {
$attachments[$val->ID] = $_attachments[$key];
}
}

if (empty($attachments)) return '';

$output = "<div class=\"lightgallery gallery\">\n";

foreach ($attachments as $id => $attachment) {

$img = wp_get_attachment_image_src($id, 'full');

$output .= "<a href=\"{$img[0]}\" class=\"col-lg-4 col-md-6 col-sm-12\">\n";
$output .= "<img src=\"{$img[0]}\" width=\"{$img[1]}\" height=\"{$img[2]}\" alt=\"\" />\n";
$output .= "</a>\n";
}

$output .= "</div>\n";

return $output;
}

the_content(); ?>
<div class="clear"></div>

        <?php $terms = get_the_terms( get_the_ID(), 'gallery-tags');
                         
if ( $terms && ! is_wp_error( $terms ) ) : 
 ?>

</div>
<?php endif; ?>
<?php endwhile; ?>

<div class="page-bottom">
<?php if($qaleb['singl-social-ac']=='1'){?><?php get_template_part('inc/share'); ?><?php } ?>
<?php if($qaleb['singl-link-ac']=='1'){?><?php get_template_part('inc/link'); ?><?php } ?>
</div>
<div id="lin-40"></div>
<div class="box-header"><b><?php echo $qaleb['single-comment-title']; ?></b></div>
<ul class="respond-detile">
<?php comments_template('/comments.php'); ?>
</ul>
<div id="post-media-balans">
<div class="cmdark_title"><b><i class="fa fa-camera-retro" aria-hidden="true"></i> گالری تصاویر مشابه </b></div>
<?php
								$categories = get_the_category();
								$cats = array();
								foreach ( $categories as $category ) { 
										$cats[] = esc_attr( $category->term_id ); 
								}
								$args = new WP_Query(array(
								'post_type' =>'gallery',
								'cat'	=> $cats,
								'posts_per_page' => $qaleb['gallery-related-count'],
								'post__not_in' => array(get_the_ID()),
								));
							if($args->have_posts()) : while($args->have_posts()) : $args->the_post();
							?>
<div class="bottom-main-media-contain">
<div class="bottom-contain-image">
<a href="<?php the_permalink(); ?>">
<?php if(has_post_thumbnail()){?><img src="<?php the_post_thumbnail_url('img-293'); ?>" alt="<?php the_title(); ?>"> <?php }else{ ?>
<img src="<?php bloginfo("template_url"); ?>/img/none.png">
<?php } ?></a>
</div>
<div class="bottom-contain-title"><h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2></div>
<div class="dark-meta">
<?php if($qaleb['singl-date-ac']=='1'){?><b><i class="fa fa-calendar-o" aria-hidden="true"></i> <?php the_time('d M Y'); ?></b><?php } ?>
<?php if($qaleb['singl-view-ac']=='1'){?><span><i class="fa fa-eye" aria-hidden="true"></i> <?php echo get_post_views (get_the_ID()); ?></span><?php } ?>
</div>
</div>
<?php endwhile; endif; wp_reset_query(); ?>
</div>
</div></div>
<script type='text/javascript' src='<?php bloginfo('template_url'); ?>/js/post_query.js'></script>
<script type="text/javascript">
$(document).ready(function() {
$(".lightgallery").lightGallery();
});
</script>
<?php get_footer(); ?>
</div>