<?php global $qaleb;?>
<?php
					$arggs = array(
					'posts_per_page' => 1, 
					'cat'	=> get_queried_object_id(),
				    );
			  
				$new_blok = new WP_Query($arggs);
				$first_post = array();
	  	if($new_blok->have_posts()) : while($new_blok->have_posts()) : $new_blok->the_post(); $first_post[] = get_the_id();?>
	 <section class="box-content">
      <div class="box-content-right">
				    <?php if(has_post_thumbnail()){?>
                  <a href="<?php the_permalink(); ?>"><?php $ata = get_the_title(); if ( has_post_thumbnail()) the_post_thumbnail('img-410', array('title' => esc_attr( $post->post_title ) , 'alt' => $ata ) ); ?></a>
                  <?php }else{ ?>
                  <img src="<?php bloginfo("template_url"); ?>/img/none.png">
                  <?php } ?>   
				   <span class="boxe-m-date"><?php the_time('d M Y'); ?></span>
				   </div>
				<div class="box-content-left">
			 <h3 class="post-title2">
			 <?php if(get_post_meta( get_the_ID(), 'meta-text-1', true )!=null){ ?> <small class="subtitle text-muted"><i class="fa fa-stop" aria-hidden="true"></i> <?php echo get_post_meta( get_the_ID(), 'meta-text-1', true ); ?></small><br> <?php } ?>
                    <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                </h3>
				
				 <div class="lead-post-excerpt-intro">
                        <p><?php if(get_meta('lead') != false) : echo get_meta('lead'); else : the_excerpt(); endif; ?></p>
                    </div>
					
            </div>	
      </section>
 <?php endwhile; endif; wp_reset_query(); ?>

 <div class="separator"></div>
 
  <section class="posts">
   <div class="lead-posts">
        <div class="row">

 <?php 
					$arggs_btn = array(
					'posts_per_page' => 3, 
					'offset'	=> 1,
					'cat'	=> get_queried_object_id(),
				    );
					
			  
				$btn_new_blok = new WP_Query($arggs_btn);
	  	if($btn_new_blok->have_posts()) : while($btn_new_blok->have_posts()) : $btn_new_blok->the_post();
			$first_post[]= get_the_id();
		?>		
		
              <div class="col-md-4">
            <div class="lead-post-excerpt"> 
				     <?php if(has_post_thumbnail()){?>
                  <a class="lead-post-excerpt-thumb" class="attachment-medium size-medium wp-post-image" href="<?php the_permalink(); ?>"><?php $ata = get_the_title(); if ( has_post_thumbnail()) the_post_thumbnail('img-200', array('title' => esc_attr( $post->post_title ) , 'alt' => $ata ) ); ?></a>
                  <?php }else{ ?>
                  <img src="<?php bloginfo("template_url"); ?>/img/none.png">
                  <?php } ?>
				   <span class="boxe-1-left-date"><?php the_time('d M Y'); ?></span> 
			 <h3 class="post-title2">
			 <?php if(get_post_meta( get_the_ID(), 'meta-text-1', true )!=null){ ?> <small class="subtitle text-muted"><i class="fa fa-stop" aria-hidden="true"></i> <?php echo get_post_meta( get_the_ID(), 'meta-text-1', true ); ?></small><br> <?php } ?>
                    <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                </h3>
            </div><!--/.lead-post-excerpt-->
        </div><!--/.col-md-4-->
<?php endwhile; endif; wp_reset_query();
					?>
</div></div>
      </section>

<div class="separator"></div>

  <section class="posts">
   <div class="box-header"><b><?php wp_title(""); ?></b></div>			
  
          <?php
				 $paged = (get_query_var('paged')) ? get_query_var('paged') : 0;
				 $arggs_cat = array( 
					'cat'	=> get_queried_object_id(),
					'paged'	=> $paged,
					'post__not_in' => $first_post
				    );
			  
            query_posts($arggs_cat);

	  	if(have_posts()) : while(have_posts()) : the_post(); ?>
        <div class="post-item-excerpt clearfix">
        <div class="post-thumbnail medium">
				 <?php if(has_post_thumbnail()){?>
                  <a class="attachment-medium size-medium wp-post-image" href="<?php the_permalink(); ?>"><?php $ata = get_the_title(); if ( has_post_thumbnail()) the_post_thumbnail('img-145', array('title' => esc_attr( $post->post_title ) , 'alt' => $ata ) ); ?></a>
                  <?php }else{ ?>
                  <img src="<?php bloginfo("template_url"); ?>/img/none.png">
                  <?php } ?>
				<span class="boxe-1-left-date"><?php the_time('d M Y'); ?></span>
        </div>
        <div class="post-excerpt">
		  <?php if(get_post_meta( get_the_ID(), 'meta-text-1', true )!=null){ ?> <small class="subtitle text-muted"><i class="fa fa-stop" aria-hidden="true"></i> <?php echo get_post_meta( get_the_ID(), 'meta-text-1', true ); ?></small> <?php } ?>
                <h3 class="post-title2">
                <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
            </h3>
            <div class="post-excerpt-summary">
                <p><?php if(get_meta('lead') != false) : echo get_meta('lead'); else : the_excerpt(); endif; ?></p>
            </div>
        </div>
    </div>	
	
   <?php endwhile;
				else:
				echo "<b>چیزی یافت نشد !</b>";
				 endif; ?>
      </section>

<?php if (function_exists("pagination")){ pagination($additional_loop->max_num_pages); } ?> 