This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Шорткод для вывода цены товара WooCommerce по ID с кастомным форматированием | |
| * [tb_product_price id="123" currency="1" sym="руб" old="1" ths="space"] | |
| */ | |
| add_shortcode( 'tb_product_price', 'tb_woo_product_price_shortcode' ); | |
| function tb_woo_product_price_shortcode( $atts ) { | |
| $atts = shortcode_atts( array( | |
| 'id' => null, | |
| 'currency' => '1', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Внедрение заголовков безопасности | |
| <IfModule mod_headers.c> | |
| Header set X-XSS-Protection "1; mode=block" | |
| Header set X-Frame-Options "SAMEORIGIN" | |
| Header set X-Content-Type-Options "nosniff" | |
| Header set Referrer-Policy "strict-origin-when-cross-origin" | |
| Header set Permissions-Policy "geolocation=(), microphone=(), camera=()" | |
| </IfModule> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT option_name, LENGTH(option_value) AS option_len | |
| FROM wp_options | |
| WHERE autoload = 'yes' | |
| ORDER BY option_len DESC | |
| LIMIT 20; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SELECT SUM(LENGTH(option_value)) / 1024 AS size_in_kb | |
| FROM wp_options | |
| WHERE autoload = 'yes'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Способ 2: Изолированный фильтр gettext для WooCommerce | |
| * Используется как запасной вариант для тем с кастомной структурой шаблонов. | |
| */ | |
| add_filter( 'gettext', 'tb_classic_heavy_cart_strings', 20, 3 ); | |
| function tb_classic_heavy_cart_strings( $translated_text, $text, $domain ) { | |
| // Мгновенно отсекаем проверку строк вне WooCommerce и в админке | |
| if ( is_admin() || 'woocommerce' !== $domain ) { | |
| return $translated_text; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Способ 1: Прямые контекстные фильтры WooCommerce | |
| * Идеально для скорости сайта. Работает на классических и легких темах. | |
| */ | |
| // 1. Изменение текста кнопки "Оформить заказ" | |
| add_filter( 'woocommerce_woocommerce_proceed_to_checkout_text', 'tb_classic_light_checkout_btn', 99 ); | |
| function tb_classic_light_checkout_btn() { | |
| return __( 'Выложить из Корзины и Оплатить', 'techbear-custom' ); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Универсальное изменение текста кнопок WooCommerce (Архивы и Карточка товара) | |
| * Разработано специально для 100% совместимости со всеми темами (включая Astra Pro, Blocksy, Elementor) | |
| * Поддерживает мультиязычность (WPML, Polylang) | |
| */ | |
| // 1. Изменение текста в Карточке товара | |
| add_filter( 'woocommerce_product_single_add_to_cart_text', 'tb_universal_single_product_text', 20, 1 ); | |
| function tb_universal_single_product_text( $text ) { | |
| global $product; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Изменение текста и ссылки на кнопке "Вернуться в магазин" | |
| */ | |
| add_filter( 'woocommerce_return_to_shop_text', 'tb_custom_return_to_shop_text' ); | |
| add_filter( 'woocommerce_return_to_shop_redirect', 'tb_custom_return_to_shop_url' ); | |
| function tb_custom_return_to_shop_text() { | |
| return 'Вернуться в каталог'; // Укажите ваш текст здесь | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter( 'password_hint', 'tb_custom_password_hint' ); | |
| function tb_custom_password_hint( $hint ) { | |
| return 'Минимум 6 символов. Используйте буквы и цифры для защиты аккаунта.'; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter('woocommerce_currency_symbol', 'techbear_change_multiple_currencies_symbols', 10, 2); | |
| function techbear_change_multiple_currencies_symbols( $currency_symbol, $currency ) { | |
| switch( $currency ) { | |
| case 'RUB': $currency_symbol = 'руб.'; break; | |
| case 'BYN': $currency_symbol = 'бел. руб.'; break; | |
| case 'KZT': $currency_symbol = 'тнг.'; break; | |
| } | |
| return $currency_symbol; | |
| } |
NewerOlder