/home/moonrcjl/public_html/wp/wp-content/themes/arsha/inc/common/arsha-breadcrumb.php
<?php
/**
 * Breadcrumbs for arsha theme.
 *
 * @package     arsha
 * @author      Nanantal
 * @copyright   Copyright (c) 2022, Nanantal
 * @link        https://www.weblearnbd.net
 * @since       arsha 1.0.0
 */



function arsha_breadcrumb_func() {
    global $post;  
    $breadcrumb_class = '';
    $breadcrumb_show = 1;

    if ( is_front_page() && is_home() ) {
        $title = get_theme_mod('breadcrumb_blog_title', __('Blog','arsha'));
        $breadcrumb_class = 'home_front_page';
    }
    elseif ( is_front_page() ) {
        $title = get_theme_mod('breadcrumb_blog_title', __('Blog','arsha'));
        $breadcrumb_show = 0;
    }
    elseif ( is_home() ) {
        if ( get_option( 'page_for_posts' ) ) {
            $title = get_the_title( get_option( 'page_for_posts') );
        }
    }
    elseif ( is_single() && 'post' == get_post_type() ) {
      $title = get_the_title();
    } 
    elseif ( is_single() && 'product' == get_post_type() ) {
        $title = get_theme_mod( 'breadcrumb_product_details', __( 'Shop', 'arsha' ) );
    } 
    elseif ( is_single() && 'courses' == get_post_type() ) {
      $title = esc_html__( 'Course Details', 'arsha' );
    } 
    elseif ( is_search() ) {
        $title = esc_html__( 'Search Results for : ', 'arsha' ) . get_search_query();
    } 
    elseif ( is_404() ) {
        $title = esc_html__( 'Page not Found', 'arsha' );
    } 
    elseif ( is_archive() ) {
        $title = get_the_archive_title();
    } 
    else {
        $title = get_the_title();
    }
 


    $_id = get_the_ID();

    if ( is_single() && 'product' == get_post_type() ) { 
        $_id = $post->ID;
    } 
    elseif ( function_exists("is_shop") AND is_shop()  ) { 
        $_id = wc_get_page_id('shop');
    } 
    elseif ( is_home() && get_option( 'page_for_posts' ) ) {
        $_id = get_option( 'page_for_posts' );
    }

    $is_breadcrumb = function_exists('tpmeta_field')? tpmeta_field('arsha_check_bredcrumb') : 'on';

    $con1 = $is_breadcrumb && ($is_breadcrumb== 'on') && $breadcrumb_show == 1;

    $con_main = is_404() ? is_404() : $con1;
    
      if (  $con_main ) {
        $bg_img_from_page = function_exists('tpmeta_image_field')? tpmeta_image_field('arsha_breadcrumb_bg') : '';

        $hide_bg_img = function_exists('tpmeta_field')? tpmeta_field('arsha_check_bredcrumb_img') : 'on';

        // get_theme_mod
        $bg_img = get_theme_mod( 'breadcrumb_image' );
        $breadcrumb_padding = get_theme_mod( 'breadcrumb_padding' );
        $breadcrumb_bg_color = get_theme_mod( 'breadcrumb_bg_color', '#16243E' );
        $breadcrumb_shape_switch = get_theme_mod( 'breadcrumb_shape_switch', 'on' );

        if ( $hide_bg_img == 'off' ) {
            $bg_main_img = '';
        }else{  
            $bg_main_img = !empty( $bg_img_from_page ) ? $bg_img_from_page['url'] : $bg_img;
        }

        $breadcrumb_sub_title_page = function_exists('tpmeta_field')? tpmeta_field('arsha_breadcrumb_sub_title') : '';
        $breadcrumb_sub_title_kirki = get_theme_mod( 'breadcrumb_sub_title' );

        $breadcrumb_sub_title_main = !empty( $breadcrumb_sub_title_page ) ? $breadcrumb_sub_title_page : $breadcrumb_sub_title_kirki;
        
        ?>

<!-- Breadcrumb Area Start -->
<section class="mt-breadcrumb-area mt-breadcrumb-bg mt-breadcrumb-space p-relative fix"
    data-background="<?php echo esc_url($bg_main_img); ?>">
    <div class="container">
        <div class="row align-items-center">
            <div class="col-lg-12 mb-30">
                <div class="mt-breadcrumb z-index-2 text-center">
                    <h1 class="mt-breadcrumb-title mb-10"><?php echo arsha_kses( $title ); ?></h1>
                    <?php if(function_exists('bcn_display')) : ?>
                    <div class="mt-breadcrumb-list">
                        <?php bcn_display(); ?>
                    </div>
                    <?php endif; ?>
                </div>
            </div>
        </div>
    </div>
</section>

<?php
      }
}

add_action( 'arsha_before_main_content', 'arsha_breadcrumb_func' );

// arsha_search_form
function arsha_search_form() {

     $arsha_search_logo = get_template_directory_uri() . '/assets/img/logo/white-logo.png';
     $arsha_search_logo_url = get_theme_mod( 'header_search_logo', $arsha_search_logo );

    ?>

   <!-- mt header search  -->
   <div class="mt-header-search-bar d-flex align-items-center">
      <button class="mt-search-close">×</button>
      <div class="container">
         <div class="row justify-content-center">
            <div class="col-lg-6">
               <div class="mt-search-bar text-center">
                  <h2 class="mt-search-bar-title mb-30"><?php echo esc_html__('What are you looking for?', 'arsha'); ?></h2>
                  <div class="contact-form-box contact-search-form-box">
                     <form action="<?php print esc_url( home_url( '/' ) );?>">
                        <input name="s" value="<?php echo esc_attr( get_search_query() )?>" type="text" placeholder="<?php echo esc_attr__('Search Here','arsha'); ?>">
                        <button type="submit"><i class="far fa-search"></i></button>
                     </form>
                  </div>
               </div>
            </div>
         </div>
      </div>
   </div>

<?php
}
add_action( 'arsha_before_main_content', 'arsha_search_form' );