File: /var/www/html/shootinschool/wp-content/themes/splash-child/partials/global/title-box.php
<?php
$post_id = get_the_ID();
$current_page = get_queried_object();
if(!empty($current_page->ID) and $current_page->ID == get_option( 'page_for_posts' )) {
$post_id = get_option('page_for_posts');
}
$title = '';
$show_breadcrumbs = true;
$is_shop = false;
$is_product = false;
$is_product_category = false;
if( function_exists( 'is_shop' ) && is_shop() ){
$is_shop = true;
}
if( function_exists( 'is_product_category' ) && is_product_category() ){
$is_product_category = true;
}
if( function_exists( 'is_product' ) && is_product() ){
$is_product = true;
}
if(!class_exists('WooCommerce')) {
$is_product_category = false;
$is_product = false;
}
if( is_category() || is_search() || is_tag() || is_year() || is_month() || is_day() ){
$post_id = get_option( 'page_for_posts' );
}
if( $is_shop or $is_product_category) {
$post_id = get_option( 'woocommerce_shop_page_id' );
}
$site_pages_show_title = get_theme_mod('pages_show_title', true);
$site_pages_show_bc = get_theme_mod('pages_show_breadcrumbs', true);
$page_hide_title = get_post_meta($post_id, 'page_title', true);
$page_hide_bc = get_post_meta($post_id, 'page_breadcrumbs', true);
if($site_pages_show_title) {
$title = get_the_title($post_id);
}
if(!empty($page_hide_title) and $page_hide_title == 'on' ) {
$title = '';
}
if(get_post_type() == 'sp_player') {
$player_title = get_theme_mod('player_title', true);
if(is_layout("bb") && $player_title) {
$title = '';
}elseif(is_layout("af") || is_layout("sccr")){
$title = trim(preg_replace("/[0-9]{1,}/", "", $title));
}elseif(is_layout("baseball")){
$number = preg_match("/[0-9]{1,}/", $title, $matches, PREG_OFFSET_CAPTURE);
$title = trim(preg_replace("/[0-9]{1,}/", "", $title));
$title = $title . " | " .esc_html__("#", "splash") . $matches[0][0];
}
}
if(!$site_pages_show_bc) {
$show_breadcrumbs = false;
}
if(!empty($page_hide_bc) and $page_hide_bc == 'on') {
$show_breadcrumbs = false;
}
$transparent_header = get_post_meta($post_id, 'transparent_header', true);
$tr_header= '';
if(!empty($transparent_header) and $transparent_header == 'on') {
$tr_header = 'transparent-header_on';
}
/*TITLE*/
if(!empty($current_page->name) and !$is_shop) {
$title = $current_page->name;
}
if(!empty($current_page->label) and !$is_shop) {
$title = $current_page->label;
}
if(is_search()) {
$title = esc_html__('Search', 'splash');
}
$shop_archive = get_option('woocommerce_shop_page_id');
$style = "";
if(is_af()) {
if ($show_breadcrumbs) $style = "style='padding-top: 27px; padding-bottom: 0px;'";
if (!empty($tr_header)) $style = "style='padding-top: 0 !important;'";
}
if(get_option( 'page_on_front' ) == get_the_ID()) {
$style = "style='padding-top: 0; padding-bottom: 0px;'";
}
if(!empty($page_hide_title) and $page_hide_title == 'on' && is_layout("baseball") ) {
$style = "style='padding-top: 0; padding-bottom: 0px;'";
}
if($is_shop) {
echo "<div class='stm-revslider-wrap'>";
$show_slider = get_theme_mod( 'shop_slider' );
$show_slider_slug = get_theme_mod( 'select_shop_slider' );
if ( !empty( $show_slider ) && $show_slider == "show" ) {
putRevSlider( $show_slider_slug );
}
echo "</div>";
}
echo '<div class="stm-title-box-unit '.$tr_header.'" ' . $style . '>';
if ($show_breadcrumbs && !is_layout("bb") && get_theme_mod('header_type', 'header_1') != "header_4") {
/*Breadcrumbs*/
if ( $is_shop || $is_product || $is_product_category ) {
woocommerce_breadcrumb();
} else {
if ( function_exists( 'bcn_display' ) ) { ?>
<div class="stm-breadcrumbs-unit normal_font">
<div class="container">
<div class="navxtBreads">
<?php bcn_display(); ?>
</div>
</div>
</div>
<?php }
}
}
if(!empty($title)): ?>
<div class="stm-page-title">
<div class="container">
<div class="clearfix stm-title-box-title-wrapper" id="inner-page-title">
<div class="wpb_wrapper">
<!-- <h1 class="stm-main-title-unit"><?php //echo sanitize_text_field($title); ?></h1> -->
<?php
$parts = explode(" ", $title);
$firstname = $parts[0];
unset($parts[0]);
$secondname = implode(" ", $parts);
?>
<h1 class="heading-one"><?php echo sanitize_text_field($firstname); ?> <span class="specail-title" style="color: #ffffff;"><?php echo sanitize_text_field($secondname); ?></span></h1></div>
<?php if(!is_af() && !empty($shop_archive) and $shop_archive == $post_id or $is_product_category) {
get_template_part('partials/global/shop-cats');
} ?>
</div>
</div>
</div>
<?php endif; ?>
<?php if ($show_breadcrumbs && is_layout("bb") && get_theme_mod('header_type', 'header_1') != "header_4") {
/*Breadcrumbs*/
if ( $is_shop || $is_product || $is_product_category ) {
woocommerce_breadcrumb();
} else {
if ( function_exists( 'bcn_display' ) ) { ?>
<div class="stm-breadcrumbs-unit heading-font">
<div class="container">
<div class="navxtBreads">
<?php bcn_display(); ?>
</div>
</div>
</div>
<?php }
}
}
echo '</div>';