/** * Custom Translation woocommerce and wordpress only on the Frontend !!! */ add_action('after_setup_theme', 'register_frontend_translation_filters'); function register_frontend_translation_filters() { if (!is_admin()) { add_filter('gettext', 'translate_reply'); add_filter('ngettext', 'translate_reply'); } } function translate_reply($translated) { $translated = str_ireplace('Enter your e-mail', 'Введите ваш email', $translated); $translated = str_ireplace('Просмотр корзины', 'товар в корзине', $translated); $translated = str_ireplace('Filters', 'поиск и фильтр товаров', $translated); $translated = str_ireplace('Show', 'показать', $translated); $translated = str_ireplace('Cancel', 'отмена', $translated); return $translated; } /** * Custom Translation only on the Frontend (exclude checkout - issue) */ add_action('after_setup_theme', 'register_frontend_translation_filters'); function register_frontend_translation_filters() { if (!is_admin()) { add_filter('gettext', 'translate_reply'); add_filter('ngettext', 'translate_reply'); } } function translate_reply($translated) { // Exclude translations on the WooCommerce checkout page if (function_exists('is_checkout') && is_checkout()) { return $translated; } // Translate other strings $translated = str_ireplace('Enter your e-mail', 'Введите ваш email', $translated); $translated = str_ireplace('Просмотр корзины', 'товар в корзине', $translated); $translated = str_ireplace('Filters', 'фильтр товаров', $translated); $translated = str_ireplace('Show', 'показать', $translated); $translated = str_ireplace('Cancel', 'отмена', $translated); $translated = str_ireplace('Размещение заказа', 'Оформить заказ', $translated); return $translated; }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter