<?php get_header(); ?>
<?php global $qaleb;?>
<?php if($qaleb['gallery-slider'] == '1'){ ?>
<div class="slider-page">
<div class="container">
<div class="wrapper">
<div class="ap-slider_gallery clearfix">
<div class="polist">
<?php
			  
			  if($qaleb['gallery-content']=='1'){
				$arggs = array(
					'post_type' => 'gallery',
					'posts_per_page' => $qaleb['gallery-count'],
				);
			  }else if($qaleb['gallery-content']=='2'){
				$arggs = array(
					'post_type' => 'gallery',
					'posts_per_page' => $qaleb['gallery-count'],
					'orderby'	=> 	'rand'
				);
			  }else if($qaleb['gallery-content']=='3'){
				$arggs = array(
					'post_type' => 'gallery',
					'posts_per_page' => $qaleb['gallery-count'],
					'tax_query' => array(
                        array(
                            'taxonomy' => 'gallery_category',
                            'field'    => 'term_id',
                            'terms'    => $qaleb['gallery-type-select'],
                        ),
				    ),
				);
			  }
			  
            query_posts($arggs);
            if(have_posts()) : while(have_posts()) : the_post(); ?>	
<article class="item">
<div class="thumbnail">
<?php if(has_post_thumbnail()){?>
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a>
<?php }else{ ?>
<img src="<?php bloginfo("template_url"); ?>/img/none.png">
<?php } ?>
 </div>
<div class="det">
<h3><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
</div>
</article>
<?php endwhile; endif;  wp_reset_query(); ?>
</div>
</div>
</div>
</div>
</div>  	          
<?php } ?>

<div class="container">
<div class="wrapper">
<div class="ap-page">
<div class="ttit">
<h3><?php the_archive_title(); ?></h3>
</div>
<div class="postlist">
<?php if(have_posts()) : ?> <?php while(have_posts()) : the_post(); ?>
<div class="item">
<div class="thumbnail">
<?php if(has_post_thumbnail()){?>
<a href="<?php the_permalink(); ?>"><img src="<?php the_post_thumbnail_url('loop-2'); ?>" alt="<?php the_title(); ?>"></a>
<?php }else{ ?>
<img src="<?php bloginfo("template_url"); ?>/img/none.png">
<?php } ?>				
 </div>
		 <div class="det">
            <div class="play"><i class="fa fa-camera"></i></div>
            <p><?php the_title(); ?></p>
            <time><span><?php the_date('');  ?></b></span></time>
          </div>
           <a class="plink" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"></a> 
        </div>         
<?php endwhile; else: echo "<p>چیزی یافت نشد !</p>"; endif; ?>
 </div>
<?php if (function_exists("pagination")){ pagination($additional_loop->max_num_pages); } ?>
</div>
</div>
</div>
<?php get_footer(); ?>