<?php



$bread_style = glowify_wp_option('bread_style') ?? 'default';
$bstyle = isset($_GET['bstyle']) ? sanitize_text_field($_GET['bstyle']) : $bread_style;


$enable_shop_bc = glowify_wp_option('enable_shop_bc');
$shop_bc_custom_title = glowify_wp_option('shop_bc_custom_title');
$shop_bc_bg = glowify_wp_option('shop_bc_bg');
$shop_bc_bg_src = is_array($shop_bc_bg) ? wp_get_attachment_image_src($shop_bc_bg['id'], 'full') : false;



if ( ! isset( $post ) || ! is_a( $post, 'WP_Post' ) ) {
    $post = get_queried_object();
}

?>
   <?php if ( $bstyle === 'classic' ) : ?>
        <div class="cs_breadcamp_wrap cs_style_2 cs_accent_strong_bg cs_bg_filed">
            <div class="container">
                <div class="cs_breadcamp_in">
                <h1 class="cs_breadcamp_title cs_fs_36 cs_semibold cs_white_color">
                    <?php 
                        if (is_search()) {
                            echo esc_html__('Search Results for: ', 'glowify-wp') . get_search_query();
                        } elseif (is_product_category() || is_tax()) {
                            single_term_title();
                        } elseif (is_product()) {
                            echo esc_html($bc_custom_title ?: get_the_title());
                        } elseif (is_shop()) {
                            echo esc_html($shop_bc_custom_title ?: __('Shop', 'glowify-wp'));
                        } else {
                            echo esc_html__('Shop', 'glowify-wp');
                        }
                    ?>
                </h1>
              
                <ol class="breadcrumb cs_fs_18 mb-0 cs_white_color">
                    <li class="breadcrumb-item"><a href="<?php echo esc_url(home_url('/')); ?>"><?php esc_html_e('Home', 'glowify-wp'); ?></a></li>
                    <li class="breadcrumb-item active">
                    <?php
                        if (is_search()) {
                            echo esc_html__('Search', 'glowify-wp');
                        } elseif (is_product_category() || is_tax()) {
                            single_term_title();
                        } elseif (is_product()) {
                            the_title();
                        } elseif (is_shop()) {
                            echo esc_html__('Shop', 'glowify-wp');
                        } else {
                            the_title();
                        }
                        ?>
                    </li>
                </ol>
                </div>
            </div>
        </div>
    <?php else :?>   
         <!-- Breadcrumbs -->
         <?php if ( $enable_shop_bc == true ) : ?>

            <?php if ( $bstyle === 'default' ) : ?>
                <div class="cs_height_40 cs_height_lg_30"></div>
                <div class="container">
                    <div class="cs_breadcamp_wrap cs_style_1 cs_type_1 cs_accent_light_bg cs_bg_filed cs_radius_8" 
            <?php else : ?>
                <div class="cs_breadcamp_wrap cs_style_1 cs_accent_light_bg cs_bg_filed" 
            <?php endif;?>

            <?php if (is_shop() || is_search() || is_product_category() || is_tax()) : ?>
                <?php if(!empty($shop_bc_bg_src[0])) :?>
                data-src="<?php echo esc_url($shop_bc_bg_src[0]); ?>"
                <?php endif;?>
            <?php elseif (!empty($bc_page_background_src[0])) : ?>
                data-src="<?php echo esc_url($bc_page_background_src[0]); ?>"
            <?php endif; ?>>
                <?php if ( $bstyle === 'full' ) : ?>
                    <div class="container">
                <?php endif;?>
                <div>
                <h1 class="cs_breadcamp_title cs_fs_54 cs_semibold">  
                <?php
                    if (is_search()) {
                        echo esc_html__('Search Results for: ', 'glowify-wp') . get_search_query();
                    } elseif (is_product_category() || is_tax()) {
                        single_term_title();
                    } elseif (is_product()) {
                        echo esc_html($bc_custom_title ?: get_the_title());
                    } elseif (is_shop()) {
                        echo esc_html($shop_bc_custom_title ?: __('Shop', 'glowify-wp'));
                    } else {
                        echo esc_html__('Shop', 'glowify-wp');
                    }
                    ?>
                </h1>
                <ol class="breadcrumb cs_fs_18 mb-0">
                    <li class="breadcrumb-item"><a href="<?php echo esc_url(home_url('/')); ?>"><?php esc_html_e('Home', 'glowify-wp'); ?></a></li>
                    <li class="breadcrumb-item active">
                    <?php
                        if (is_search()) {
                            echo esc_html__('Search', 'glowify-wp');
                        } elseif (is_product_category() || is_tax()) {
                            single_term_title();
                        } elseif (is_product()) {
                            the_title();
                        } elseif (is_shop()) {
                            echo esc_html__('Shop', 'glowify-wp');
                        } else {
                            the_title();
                        }
                        ?>
                    </li>
                </ol>
                </div>

        </div>
        </div>
        <?php endif;?>

    <?php endif;?>

   


    
  


