<?php
// Header File
 get_header();
global  $cs_theme_option; 
        	if(isset($cs_theme_option['cs_layout'])){ $cs_layout = $cs_theme_option['cs_layout']; }else{ $cs_layout = 'right';} 
			if(isset($cs_theme_option['default_excerpt_length']) && $cs_theme_option['default_excerpt_length'] <> ''){ $default_excerpt_length = $cs_theme_option['default_excerpt_length']; }else{ $default_excerpt_length = '255';} 
 			if ( $cs_layout <> '' and $cs_layout  <> "none" and $cs_layout  == 'left') : 
		?>
            <aside class="left-content col-md-3">
              <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar($cs_theme_option['cs_sidebar_left']) ) : endif; ?>
            </aside>
        <?php endif; ?>
        <div class="<?php cs_default_pages_meta_content_class( $cs_layout ); ?>">
          <div class="postlist blog archive-page">
            <?php if ( have_posts() ) :
			
			 ?>
            <?php /* The loop */
 			   if (empty($_GET['page_id_all']))
					  $_GET['page_id_all'] = 1;
				  if (!isset($_GET["s"])) {
					  $_GET["s"] = '';
				  }
		   ?>
            <?php while ( have_posts() ) : the_post(); 
			$image_url = cs_attachment_image_src(get_post_thumbnail_id($post->ID), 342, 193);
			$post_class = '';
			 if($image_url == ''){
			  $post_class = ' no-image';
			 }
 			 ?>
 			 
 			 	<!-- Text Start -->
                  	<?php include(locate_template('archive-loop.php')); ?>
                 <!-- Text End -->
               
            <?php 
				endwhile; 
			else:
				fnc_no_result_found();
			endif; 
			?>
            <?php
				$qrystr = '';
				if ( isset($_GET['page_id']) ) $qrystr .= "&page_id=".$_GET['page_id'];
				// pagination start
					if (isset($cs_theme_option['pagination']) and $cs_theme_option['pagination'] == "Show Pagination" and $wp_query->found_posts > get_option('posts_per_page')) {
						echo cs_pagination(wp_count_posts()->publish,get_option('posts_per_page'), $qrystr);
					 }
				// pagination end
			?>
          </div>
        </div>
		<?php
			if ( $cs_layout <> '' and $cs_layout  <> "none" and $cs_layout  == 'right') :  ?>
				<aside class="left-content col-md-3">
  				<?php 
 					if(isset($cs_theme_option['cs_sidebar_right'])){
					if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar($cs_theme_option['cs_sidebar_right']) ) : endif;
					}else{
						if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar-1') ) : endif;
					}
					  ?>
            </aside>
         <?php endif; ?>
<?php get_footer(); ?>