This commit is contained in:
2026-04-19 16:50:40 +03:00
parent ab788c762c
commit c19df05b57
8 changed files with 231 additions and 487 deletions

View File

@@ -10,6 +10,12 @@ $test1_header_action_label = isset( $test1_header_action_label ) ? $test1_header
$test1_header_mode = isset( $test1_header_mode ) ? $test1_header_mode : 'link';
$posts_page_id = (int) get_option( 'page_for_posts' );
$blog_url = $posts_page_id > 0 ? get_permalink( $posts_page_id ) : home_url( '/blog/' );
$cart_url = function_exists( 'wc_get_cart_url' ) ? wc_get_cart_url() : home_url( '/cart/' );
$cart_count = 0;
if ( function_exists( 'WC' ) && WC()->cart ) {
$cart_count = (int) WC()->cart->get_cart_contents_count();
}
if ( ! $blog_url ) {
$blog_url = home_url( '/blog/' );
@@ -47,10 +53,10 @@ $blog_is_active = is_home() || is_singular( 'post' ) || is_category() || is_tag(
<span aria-hidden="true">+7 (911) 774-89-23</span>
</a>
<?php if ( 'cart' === $test1_header_mode ) : ?>
<button class="cart-button" id="cartOpenButton" aria-label="Открыть корзину">
<a class="cart-button" href="<?php echo esc_url( $cart_url ); ?>" aria-label="Перейти в корзину">
<span aria-hidden="true">Корзина</span>
<span class="cart-count" id="cartCount" aria-live="polite" aria-atomic="true">0</span>
</button>
<span class="cart-count" aria-live="polite" aria-atomic="true"><?php echo esc_html( (string) $cart_count ); ?></span>
</a>
<button class="mobile-toggle" id="mobileToggle" aria-label="Открыть меню" aria-expanded="false" aria-controls="mobilePanel">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
<path d="M4 7H20" stroke="currentColor" stroke-width="2" stroke-linecap="round"/>
@@ -76,10 +82,10 @@ $blog_is_active = is_home() || is_singular( 'post' ) || is_category() || is_tag(
<a href="<?php echo esc_url( home_url( '/contacts/' ) ); ?>">Контакты</a>
</nav>
<a class="header-phone" href="tel:+79117748923">+7 (911) 774-89-23</a>
<button class="cart-button" id="mobileCartOpenButton" aria-label="Открыть корзину с мобильного меню">
<a class="cart-button" href="<?php echo esc_url( $cart_url ); ?>" aria-label="Перейти в корзину с мобильного меню">
<span>Корзина</span>
<span class="cart-count" id="mobileCartCount" aria-live="polite" aria-atomic="true">0</span>
</button>
<span class="cart-count" aria-live="polite" aria-atomic="true"><?php echo esc_html( (string) $cart_count ); ?></span>
</a>
</div>
</div>
<?php endif; ?>