true, 'tablet' => true, 'mobile' => false, ]); $cart_visibility = [ 'desktop' => false, 'tablet' => false, 'mobile' => false, ]; if (function_exists('woocommerce_mini_cart')) { $cart_visibility = get_theme_mod('header_cart_visibility', [ 'desktop' => true, 'tablet' => true, 'mobile' => false, ]); } $special_elements_class .= ' ' . blocksy_visibility_matching( $search_visibility, $cart_visibility ); return trim($special_elements_class); } function blocksy_output_site_branding($is_mobile = false) { ?>
'custom-logo', 'itemprop' => 'logo', ]; /** * If the logo alt attribute is empty, get the site title and explicitly * pass it to the attributes used by wp_get_attachment_image(). */ $image_alt = get_post_meta( $custom_logo_id, '_wp_attachment_image_alt', true ); if ( empty( $image_alt ) ) { $custom_logo_attr['alt'] = get_bloginfo( 'name', 'display' ); } add_filter( 'wp_get_attachment_image_attributes', 'blocksy_handle_retina_logo', 10, 3 ); /** * If the alt attribute is not empty, there's no need to explicitly pass * it because wp_get_attachment_image() already adds the alt attribute. */ $html = sprintf( '%2$s', esc_url( home_url( '/' ) ), wp_get_attachment_image( $custom_logo_id, 'full', false, $custom_logo_attr ) ); remove_filter( 'wp_get_attachment_image_attributes', 'blocksy_handle_retina_logo', 10, 3 ); return $html; } function blocksy_handle_retina_logo( $attr, $attachment, $size ) { $retina_logo_id = null; $custom_logo_id = get_theme_mod( 'header_logo' ); if ( ! isset( $custom_logo_id['attachment_id'] ) ) { $custom_logo_id['attachment_id'] = null; } $custom_logo_id = $custom_logo_id['attachment_id']; if (get_theme_mod('has_retina_logo', 'no') === 'yes') { $retina_logo_id = get_theme_mod('retina_header_logo'); if ( ! isset( $retina_logo_id['attachment_id'] ) ) { $retina_logo_id['attachment_id'] = null; } $retina_logo_id = $retina_logo_id['attachment_id']; } if (!$retina_logo_id || !$custom_logo_id) { return $attr; } $attr['srcset'] = ''; $cutom_logo_src = wp_get_attachment_image_src( $custom_logo_id , 'full' ); $cutom_logo_url = $cutom_logo_src[0]; $retina_logo_src = wp_get_attachment_image_src( $retina_logo_id , 'full' ); $retina_logo_url = $retina_logo_src[0]; $attr['srcset'] = $retina_logo_url . ' 1x, ' . $retina_logo_url . ' 2x'; unset( $attr['sizes'] ); return $attr; } function blocksy_output_header_top_bar() { $columns_output = ''; $header_section_1 = get_theme_mod( 'header_top_bar_section_1', 'header_menu' ); $header_section_2 = get_theme_mod( 'header_top_bar_section_2', 'disabled' ); if ( $header_section_1 !== 'disabled' && $header_section_2 !== 'disabled' ) { $columns_output = 'data-columns="2"'; } else { if ( $header_section_1 !== 'disabled' || $header_section_2 !== 'disabled' ) { $columns_output = 'data-columns="1"'; } } $container_class = ( get_theme_mod( 'top_bar_container', 'fixed' ) === 'fixed' ) ? 'ct-container' : 'ct-container-fluid'; $main_class = 'header-top-bar'; $main_class .= ' ' . blocksy_visibility_classes( get_theme_mod('top_bar_visibility', [ 'desktop' => true, 'tablet' => true, 'mobile' => false, ]) ); $stacking_output = blocksy_stacking( get_theme_mod('top_bar_stacking', [ 'tablet' => true, 'mobile' => true, ]) ); ob_start(); ?>