';
$output .= get_header_image_tag();
$output .= '';
if( $show_header_image_only_home ) {
if( is_front_page() ) {
echo wp_kses_post( $output );
}
return;
}
echo wp_kses_post( $output );
}
/**
* Desktop header markup
*/
public function header_markup() {
$layout = get_theme_mod( 'header_layout_desktop', 'header_layout_1' );
call_user_func( array( $this, $layout ) ); ?>
'primary') ); ?>
';
}
?>
class="button header-item" href="">
';
echo wp_kses_post( $header_html_content );
echo '';
}
/**
* Shortcode
*/
public function shortcode() {
$header_shortcode_content = get_theme_mod( 'header_shortcode_content' );
if( ! $header_shortcode_content ) {
return '';
}
echo '';
}
/**
* Login/Register
*/
public function login_register() {
$output = '';
if( ! class_exists( 'Woocommerce' ) ) {
return '';
}
if( is_user_logged_in() ) {
$show_welcome_message = get_theme_mod( 'login_register_show_welcome_message', 1 );
if( ! $show_welcome_message ) {
return;
}
$current_user = wp_get_current_user();
/* translators: 1: display name. */
$welcome_message_text = get_theme_mod( 'login_register_welcome_message_text', sprintf( esc_html__( 'Welcome %s', 'botiga' ), '{display_name}' ) );
$welcome_message_text = str_replace(
array( '{user_firstname}', '{user_lastname}', '{user_email}', '{user_login}', '{display_name}' ),
array($current_user->user_firstname, $current_user->user_lastname, $current_user->user_email, $current_user->user_login, $current_user->display_name ),
$welcome_message_text
);
$output .= '' . esc_html( $welcome_message_text ) . '';
$output .= '';
} else {
$login_register_link_text = get_theme_mod( 'login_register_link_text', esc_html__( 'Login', 'botiga' ) );
$login_register_popup = get_theme_mod( 'login_register_popup', 0 );
$link_classes = array( 'botiga-login-register-link' );
if( $login_register_popup ) {
$link_classes[] = 'has-popup';
}
$output .= ''. esc_html( $login_register_link_text ) .'';
}
echo '';
}
/**
* Woocommerce icons
*/
function woocommerce_icons() {
if ( !class_exists( 'WooCommerce' ) ) {
return;
}
echo botiga_woocommerce_header_cart(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
/**
* Mobile Woocommerce icons
*/
function mobile_woocommerce_icons() {
if ( !class_exists( 'WooCommerce' ) ) {
return;
}
get_template_part( 'template-parts/header-mobile/content-header-mobile', 'icons' );
}
/**
* Mobile Offcanvas Woocommerce icons
*/
function mobile_offcanvas_woocommerce_icons() {
if ( !class_exists( 'WooCommerce' ) ) {
return;
}
get_template_part( 'template-parts/header-mobile/content-header-mobile-offcanvas', 'icons' );
}
/**
* Search icon
*/
public function search() {
?>
'primary') );
}
$icon = get_theme_mod( 'mobile_menu_icon', 'mobile-icon2' ); ?>
ID ) ? get_post_meta( $post->ID, '_botiga_disable_header_transparent', true ) : false;
if( $post_meta_disable ) {
return;
}
// Include on Front Page
if( is_front_page() && ! in_array( 'front-page', $display_on ) ) {
return;
}
// Include on normal pages
// we need check for WooCommerce here because "is_cart()", "is_checkout", etc... are functions created by WooCommerce
if( class_exists( 'Woocommerce' ) ) {
if( ( is_page() && ! is_front_page() && ! is_cart() && ! is_checkout() && ! is_account_page() && ! is_shop() ) && ! in_array( 'pages', $display_on ) ) {
return;
}
} else {
if( ( is_page() && ! is_front_page() ) && ! in_array( 'pages', $display_on ) ) {
return;
}
}
// Include on Blog Archive
if( ( is_home() || is_category() || is_tag() ) && ! in_array( 'blog-archive', $display_on ) ) {
return;
}
// Include on Blog Posts
if( is_singular( 'post' ) && ! in_array( 'blog-posts', $display_on ) ) {
return;
}
if( class_exists( 'Woocommerce' ) ) {
// Include on Shop Catalog
if( ( is_shop() || is_product_category() || is_product_tag() || is_product_taxonomy() ) && ! in_array( 'shop-catalog', $display_on ) ) {
return;
}
// Include on Shop Products
if( is_singular( 'product' ) && ! in_array( 'shop-products', $display_on ) ) {
return;
}
// Include on Shop Cart
if( is_cart() && ! in_array( 'shop-cart', $display_on ) ) {
return;
}
// Include on Shop Checkout
// we need to check if "is_singular" to avoid extra "Buy Now" plugins conflict
if( is_checkout() && ! is_singular( 'product' ) && ! in_array( 'shop-checkout', $display_on ) ) {
return;
}
// Include on Shop My Account
if( is_account_page() && ! in_array( 'shop-my-account', $display_on ) ) {
return;
}
// Include on Wishlist page
if( is_page_template( 'page-templates/template-wishlist.php' ) && ! in_array( 'shop-wishlist', $display_on ) ) {
return;
}
}
// Include on Search Page
if( is_search() && ! in_array( 'post-search', $display_on ) ) {
return;
}
// Include on 404 Page
if( is_404() && ! in_array( '404', $display_on ) ) {
return;
}
if( $topbar_transparent ) {
add_action( 'botiga_header', array( $this, 'header_transparent_wrapper_open' ), -1 );
} else {
add_action( 'botiga_header', array( $this, 'header_transparent_wrapper_open' ), 9 );
}
if( $header_transparent ) {
add_action( 'botiga_header', array( $this, 'header_transparent_wrapper_close' ), 11 );
} else {
add_action( 'botiga_header', array( $this, 'header_transparent_wrapper_close' ), 6 );
}
add_filter( 'body_class', function( $classes ){
$classes[] = 'header-transparent';
return $classes;
} );
}
public function header_transparent_wrapper_open() {
echo '';
}
}
/**
* Initialize class
*/
Botiga_Header::get_instance();
endif;