<?php
	global $post;
 	$customizer_show_breadcrumb = get_theme_mod('show_breadcrumb','yes');
 	$customizer_image_cover = get_theme_mod('blog_cover');
 	$blog_cover=$customizer_image_cover;
 	$title = get_theme_mod('blog_heading_text','Blog');
 	
	if(is_category()){
 		global $wp_query;
 		$cat_obj = $wp_query->get_queried_object();
        $thisCat = $cat_obj->term_id;
        $thisCat = get_category($thisCat);
 		$title=$thisCat->name;
 	}elseif(is_archive()){
 		$blog_cover=$customizer_image_cover;
 	}elseif(is_search()){
 		$title=get_search_query();
 		$blog_cover=$customizer_image_cover;
 	} else{
 		$blog_cover=$customizer_image_cover;
 	}
?>
<?php if(!is_single()) { ?>
<div class="page-head" style="background: url('<?php echo esc_url($blog_cover); ?>') no-repeat center;">
	<div class="overlay"></div>
	<div class="container">
		<div class="row">
			<div class="col-md-12 text-center">
				<?php $show_page_heading = get_post_meta(helium_get_current_id(), "helium_met_page_heading", true) ? get_post_meta(helium_get_current_id(), "helium_met_page_heading", true):'yes'; ?>

				<?php if($show_page_heading == 'yes'){ ?>
					<?php if(!is_search()){ ?>
						<h1 class="post-title"><?php echo esc_html($title);?> </h1>
					<?php }else { ?>
 						<h1 class="post-title"> <?php esc_html_e('Search', 'helium' ); ?> </h1>
					<?php 	} ?>
				<?php } ?>

				<?php if($customizer_show_breadcrumb=='yes' ){ ?>
				    <?php helium_breadcrumbs(); ?>
				<?php }  ?>
			</div>
		</div>
	</div>	
</div>
<?php }else{ ?>
	<?php if ( have_posts() ) : while ( have_posts() ) : the_post();?>
		 <?php $thumbnail_url = get_post_meta(get_the_id(), "helium_met_image_cover", true); $isCover='background-size:cover'; ?>
            <?php if($thumbnail_url){ ?>                    
                <?php $blog_cover = $thumbnail_url; ?>
            <?php }else{ ?>
				<?php if(has_post_thumbnail()){ ?>
					<?php $blog_cover= wp_get_attachment_url( get_post_thumbnail_id(get_the_id()) ) ?>
					<?php $isCover=''; ?>
				<?php } ?>
            <?php } ?>
		<div class="blog-thumb" style="background: url('<?php echo esc_url($blog_cover); ?>') no-repeat center; <?php echo esc_html($isCover); ?>; background-color: #111;">
			<div class="container">
				<div class="row">
					<div class="col-md-10 col-md-offset-1 col-sm-12">
						<div class="post-heading">
							<h1><?php helium_content_title(); /* Display title of post */ ?></h1>
							<div class="blog-meta"><?php helium_content_meta();?></div>
						</div>
					</div>
				</div>
			</div>
		</div>
	<?php 
		endwhile;
	else :
	    get_template_part( 'content/content', 'none' );

	endif;?>

	
<?php } ?>