diff --git a/wp-content/themes/cosmopet/functions.php b/wp-content/themes/cosmopet/functions.php index 0fbcf1e..9fcb336 100644 --- a/wp-content/themes/cosmopet/functions.php +++ b/wp-content/themes/cosmopet/functions.php @@ -144,76 +144,76 @@ function include_module($module_name) { -// Регистрируем стили и скрипты -add_action('wp_enqueue_scripts', function() use ($module_name, $module_dir) { - // Подключаем стили - $css_dir = $module_dir . '/assets/css'; - if (is_dir($css_dir)) { - $css_files = scandir($css_dir); - - // Приоритетные файлы - $priority_files = [ - 'normalize.css', - 'gp-style-core.css', - 'gp-style-desktop.css', - 'gp-style-tablet.css', - 'gp-style-mobile.css' - ]; + // Регистрируем стили и скрипты + add_action('wp_enqueue_scripts', function() use ($module_name, $module_dir) { + // Подключаем стили + $css_dir = $module_dir . '/assets/css'; + if (is_dir($css_dir)) { + $css_files = scandir($css_dir); - // Подключаем приоритетные файлы в заданном порядке - foreach ($priority_files as $priority_file) { - $file_path = $css_dir . '/' . $priority_file; - if (file_exists($file_path)) { - wp_enqueue_style( - $module_name . '-' . pathinfo($priority_file, PATHINFO_FILENAME), - get_template_directory_uri() . '/modules/' . $module_name . '/assets/css/' . $priority_file, - [], - filemtime($file_path) - ); + // Приоритетные файлы + $priority_files = [ + 'normalize.css', + 'gp-style-core.css', + 'gp-style-desktop.css', + 'gp-style-tablet.css', + 'gp-style-mobile.css' + ]; + + // Подключаем приоритетные файлы в заданном порядке + foreach ($priority_files as $priority_file) { + $file_path = $css_dir . '/' . $priority_file; + if (file_exists($file_path)) { + wp_enqueue_style( + $module_name . '-' . pathinfo($priority_file, PATHINFO_FILENAME), + get_template_directory_uri() . '/modules/' . $module_name . '/assets/css/' . $priority_file, + [], + filemtime($file_path) + ); + } } - } - // Подключаем остальные CSS-файлы - foreach ($css_files as $css_file) { - if ( - pathinfo($css_file, PATHINFO_EXTENSION) === 'css' && - $css_file !== '.' && - $css_file !== '..' && - !in_array($css_file, $priority_files) - ) { - $file_path = $css_dir . '/' . $css_file; - wp_enqueue_style( - $module_name . '-' . pathinfo($css_file, PATHINFO_FILENAME), - get_template_directory_uri() . '/modules/' . $module_name . '/assets/css/' . $css_file, - [], - filemtime($file_path) - ); + // Подключаем остальные CSS-файлы + foreach ($css_files as $css_file) { + if ( + pathinfo($css_file, PATHINFO_EXTENSION) === 'css' && + $css_file !== '.' && + $css_file !== '..' && + !in_array($css_file, $priority_files) + ) { + $file_path = $css_dir . '/' . $css_file; + wp_enqueue_style( + $module_name . '-' . pathinfo($css_file, PATHINFO_FILENAME), + get_template_directory_uri() . '/modules/' . $module_name . '/assets/css/' . $css_file, + [], + filemtime($file_path) + ); + } } } - } - // Подключаем скрипты - $js_dir = $module_dir . '/assets/js'; - if (is_dir($js_dir)) { - $js_files = scandir($js_dir); - foreach ($js_files as $js_file) { - if ( - pathinfo($js_file, PATHINFO_EXTENSION) === 'js' && - $js_file !== '.' && - $js_file !== '..' - ) { - $file_path = $js_dir . '/' . $js_file; - wp_enqueue_script( - $module_name . '-' . pathinfo($js_file, PATHINFO_FILENAME), - get_template_directory_uri() . '/modules/' . $module_name . '/assets/js/' . $js_file, - ['jquery'], - filemtime($file_path), - true - ); + // Подключаем скрипты + $js_dir = $module_dir . '/assets/js'; + if (is_dir($js_dir)) { + $js_files = scandir($js_dir); + foreach ($js_files as $js_file) { + if ( + pathinfo($js_file, PATHINFO_EXTENSION) === 'js' && + $js_file !== '.' && + $js_file !== '..' + ) { + $file_path = $js_dir . '/' . $js_file; + wp_enqueue_script( + $module_name . '-' . pathinfo($js_file, PATHINFO_FILENAME), + get_template_directory_uri() . '/modules/' . $module_name . '/assets/js/' . $js_file, + ['jquery'], + filemtime($file_path), + true + ); + } } } - } -}); + }); // Подключаем контроллер модуля @@ -325,6 +325,7 @@ add_filter('theme_page_templates', function ($templates) { return $templates; }); +/* Подключаем все файлы с глобальными функциями */ includeFilesFromFolder(get_template_directory() . '/global-functions'); diff --git a/wp-content/themes/cosmopet/global-functions/multisite-functions.php b/wp-content/themes/cosmopet/global-functions/multisite-functions.php index a42c7d5..56a61ca 100644 --- a/wp-content/themes/cosmopet/global-functions/multisite-functions.php +++ b/wp-content/themes/cosmopet/global-functions/multisite-functions.php @@ -1,5 +1,41 @@ ['mode' => 'production', 'region' => 'ru'], + 'cosmopet.ae' => ['mode' => 'production', 'region' => 'ae'], + 'cosmopet-test-ru.cp.good-production.xyz' => ['mode' => 'develope', 'region' => 'ru'], + 'cosmopet-test-ae.cp.good-production.xyz' => ['mode' => 'develope', 'region' => 'ae'], + ]; + + $host = strtolower($host ?: $_SERVER['SERVER_NAME']); + $config = $map[$host] ?? ['mode' => 'develope', 'region' => 'unknown']; + + $this->site_mode = $config['mode']; + $this->site_region = $config['region']; + } +} + + +add_filter('timber/twig', function (\Twig\Environment $twig) { + $site_env = new SiteEnvironment(); + $twig->addGlobal('site_region', $site_env->site_region); + $twig->addGlobal('site_mode', $site_env->site_mode); + return $twig; +}); +/* End | Работа с проверкой мультисайтовости и стендов */ + + + + + add_filter('woocommerce_currency_symbol', 'change_aed_currency_symbol', 10, 2); function change_aed_currency_symbol($currency_symbol, $currency) { diff --git a/wp-content/themes/cosmopet/modules/forms/components/discount/assets/css/discount-form.css b/wp-content/themes/cosmopet/modules/forms/components/discount/assets/css/discount-form.css index 568a6d4..f98192b 100644 --- a/wp-content/themes/cosmopet/modules/forms/components/discount/assets/css/discount-form.css +++ b/wp-content/themes/cosmopet/modules/forms/components/discount/assets/css/discount-form.css @@ -2279,6 +2279,8 @@ justify-content: center; -webkit-text-fill-color: transparent; } + + @media screen and (max-width: 991px) { .reviews__left { width: 100%; @@ -2450,6 +2452,7 @@ justify-content: center; .truth_content-wrap { padding: 0 30px; } + } @media screen and (max-width: 540px) { diff --git a/wp-content/themes/cosmopet/templates/header.twig b/wp-content/themes/cosmopet/templates/header.twig index 66f9448..f489153 100644 --- a/wp-content/themes/cosmopet/templates/header.twig +++ b/wp-content/themes/cosmopet/templates/header.twig @@ -22,9 +22,11 @@
  • {% if current_lang == 'ru' %}Лакомства{% elseif current_lang == 'en' %}Treats{% endif %}
  • -
  • - {% if current_lang == 'ru' %}Аксессуары{% elseif current_lang == 'en' %}Accessories{% endif %} -
  • + {% if site_region == 'ru' %} +
  • + {% if current_lang == 'ru' %}Аксессуары{% elseif current_lang == 'en' %}Accessories{% endif %} +
  • + {% endif %}