<?php
/**
 * Page Banner 
 */
$travelfic_prefix = 'travelfic_customizer_settings_';
$travelfic_page_banner = get_theme_mod($travelfic_prefix . 'page_banner_image', 'null');
$travelfic_pmb_background_img = get_post_meta( get_the_ID(), 'tft-pmb-background-img', [] );
$travelfic_page_sub_title =  get_post_meta( get_the_ID(), 'tft-pmb-subtitle', true ) ? get_post_meta( get_the_ID(), 'tft-pmb-subtitle', true ) : '';  
$travelfic_ImageUrl = get_template_directory_uri() . '/assets/img/page_header.png';
if (!empty( array_filter( $travelfic_pmb_background_img ) ) ) {
    $travelfic_ImageUrl = $travelfic_pmb_background_img[0];
}elseif ($travelfic_page_banner !== 'null') {
    if (!empty($travelfic_page_banner)) {
        $travelfic_ImageUrl = $travelfic_page_banner;
    } else {
        $travelfic_ImageUrl = '';
    }
}
?>
<?php if ( class_exists( 'WooCommerce' ) &&  ( is_checkout() || is_cart() ) ) : ?>    
    <div class="tf-page-header-inner tft-page-banner woo-page-header woocommerce_check" 
        <?php if (!empty($travelfic_ImageUrl)) : ?>
            style="background-image:url('<?php echo esc_url($travelfic_ImageUrl); ?>');"
        <?php endif; ?>
    >
        <div class="<?php echo esc_attr( apply_filters( 'travelfic_page_tftcontainer', $travelfic_tftcontainer = '') ); ?>">
            <div class="tft-page-banner">
                <?php the_title('<h1 class="entry-title">', '</h1>');?>
                <?php if( !empty($travelfic_page_sub_title) ){ ?>
                    <p><?php echo esc_html( $travelfic_page_sub_title ); ?></p>
                <?php } ?>
            </div>
        </div>
    </div>
<?php else: ?>
    <div class="tf-page-header-inner tft-page-banner" 
        <?php if (!empty($travelfic_ImageUrl)) : ?>
            style="background-image:url('<?php echo esc_url($travelfic_ImageUrl); ?>');"
        <?php endif; ?>
    >
        <div class="<?php echo esc_attr( apply_filters( 'travelfic_page_tftcontainer', $travelfic_tftcontainer = '') ); ?>">
            <div class="tft-page-banner">
                <?php the_title('<h1 class="entry-title">', '</h1>');?>
                <?php if( !empty($travelfic_page_sub_title) ){?>
                    <p><?php echo esc_html( $travelfic_page_sub_title ); ?></p>
                <?php } ?>
            </div>
        </div>
    </div>
<?php endif; ?>



