<?php
/**
 * Sample implementation of the Custom Header feature
 *
 * You can add an optional custom header image to header.php like so ...
 *
	<?php the_header_image_tag(); ?>
 *
 * @link https://developer.wordpress.org/themes/functionality/custom-headers/
 *
 * @package bizconsulting
 */

/**
 * Set up the WordPress core custom header feature.
 *
 * @uses bizconsulting_custom_header_setup()
 */
function bizconsulting_custom_header_setup() {
	
	add_theme_support( 'custom-header', apply_filters( 'bizconsulting_custom_header_args', array(
			'default-image' => get_template_directory_uri() . '/assets/img/pexels-photo-886465.jpeg',
			'width'         => 1920,
			'height'        => 500,
			'flex-height'   => false,
			'header-text'   => false,
	) ) );
	
	register_default_headers( array(
		'default-image' => array(
		'url' => '%s/assets/img/pexels-photo-886465.jpeg',
		'thumbnail_url' => '%s/assets/img/pexels-photo-886465.jpeg',
		'description' => esc_html__( 'Default Header Image', 'bizconsulting' ),
		),
	));
}
add_action( 'after_setup_theme', 'bizconsulting_custom_header_setup' );

if ( ! function_exists( 'bpt_home_banner_section' ) ){
function bpt_home_banner_section(){
	$header_image = get_header_image();
	if ($header_image!='' && !is_active_sidebar('sidebar-2') ) {
	?>
		<div class="page-area home_banner_section" style="background: url('<?php echo esc_url($header_image);?>');background-repeat: no-repeat;background-size: cover;background-position: top center;"><div class="breadcumb-overlay"></div>
	<?php
	}else{
	?>
		<div class="page-area home_banner_section">
	<?php
	}
        if ( is_active_sidebar('sidebar-2') ) {
			dynamic_sidebar('sidebar-2');
		}else{
		?>
			<div class="container">
				<div class="row">
					<div class="col-md-12 col-sm-12 col-xs-12">
						<div class="breadcrumb text-center">
							<div class="section-headline white-headline text-center">
								<h1 class="site-title"><?php echo esc_html(get_bloginfo( 'name' ));?></h1>
								<p class="site-description"><?php echo esc_html(get_bloginfo( 'description' ));?></p>
							</div>
						</div>
					</div>
				</div>
			</div>
		<?php
		}
		?>
	</div>
<?php
}
add_action('bpt_home_banner','bpt_home_banner_section');
}

if ( ! function_exists( 'bpt_breadcumb_fun' ) ){
function bpt_breadcumb_fun(){
	$header_image = get_header_image();
	if ( get_header_image() ){ ?>
		<div class="page-area" style="background: url('<?php echo esc_url($header_image);?>');background-repeat: no-repeat;background-size: cover;background-position: top center;">
	<?php }else{ ?>
		<div class="page-area" style="background: #111;">
	<?php } ?>
		<!-- Start Bottom Header -->
	    <div class="breadcumb-overlay"></div>
	    <div class="container">
	        <div class="row">
	            <div class="col-md-12 col-sm-12 col-xs-12">
	                <div class="breadcrumb text-center">
	                    <div class="section-headline white-headline text-center">
		                	<?php if (is_home() ){?>
		                    		<h3><?php single_post_title(); ?></h3>
		                    <?php }elseif(is_search()){?>
		                   		<h3 class="page-title"><?php
									/* translators: %s: search query. */
									printf( esc_html__( 'Search Results for: %s', 'bizconsulting' ), '<span>' . get_search_query() . '</span>' );
								?></h3>
							<?php }elseif(is_archive()){
								the_archive_title( '<h3 class="page-title">', '</h3>' );
								the_archive_description( '<div class="archive-description">', '</div>' );
		                	}elseif(is_page()){
								echo '<h3 class="page-title">'.esc_html(get_query_var('pagename')).'</h3>';
		                    }else{?>
		                    		<h3><?php //the_title(); ?></h3>
		                    <?php }

							
							if ( ! function_exists( 'breadcrumb_trail' ) ) {
								locate_template( 'vendors/breadcrumbs/breadcrumbs.php', TRUE, TRUE );
								$breadcrumb_args = array(
									'show_browse' => false,
								);
								breadcrumb_trail( $breadcrumb_args );
							}
	                    ?>
	                	</div>
	                </div>
	            </div>
	        </div>
	    </div>
	</div>
	<!-- END Header -->
<?php
}
add_action('bpt_breadcumb','bpt_breadcumb_fun');
}