Maks | feat: реализовал логику проверки доменов и режима dev/prod

pull/29/head
parent e7e74da0bd
commit d87f805b91
  1. 1
      wp-content/themes/cosmopet/functions.php
  2. 36
      wp-content/themes/cosmopet/global-functions/multisite-functions.php
  3. 3
      wp-content/themes/cosmopet/modules/forms/components/discount/assets/css/discount-form.css
  4. 2
      wp-content/themes/cosmopet/templates/header.twig

@ -325,6 +325,7 @@ add_filter('theme_page_templates', function ($templates) {
return $templates; return $templates;
}); });
/* Подключаем все файлы с глобальными функциями */
includeFilesFromFolder(get_template_directory() . '/global-functions'); includeFilesFromFolder(get_template_directory() . '/global-functions');

@ -1,5 +1,41 @@
<?php <?php
/* Start | Работа с проверкой мультисайтовости и стендов */
class SiteEnvironment
{
public string $mode;
public string $region;
public function __construct(string $host = null)
{
$map = [
'cosmopet.ru' => ['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); add_filter('woocommerce_currency_symbol', 'change_aed_currency_symbol', 10, 2);
function change_aed_currency_symbol($currency_symbol, $currency) { function change_aed_currency_symbol($currency_symbol, $currency) {

@ -2279,6 +2279,8 @@ justify-content: center;
-webkit-text-fill-color: transparent; -webkit-text-fill-color: transparent;
} }
@media screen and (max-width: 991px) { @media screen and (max-width: 991px) {
.reviews__left { .reviews__left {
width: 100%; width: 100%;
@ -2450,6 +2452,7 @@ justify-content: center;
.truth_content-wrap { .truth_content-wrap {
padding: 0 30px; padding: 0 30px;
} }
} }
@media screen and (max-width: 540px) { @media screen and (max-width: 540px) {

@ -22,9 +22,11 @@
<li class="header-pc-menu__list-li"> <li class="header-pc-menu__list-li">
<a href="/product-category/lakomstva-dlya-koshek/">{% if current_lang == 'ru' %}Лакомства{% elseif current_lang == 'en' %}Treats{% endif %}</a> <a href="/product-category/lakomstva-dlya-koshek/">{% if current_lang == 'ru' %}Лакомства{% elseif current_lang == 'en' %}Treats{% endif %}</a>
</li> </li>
{% if site_region == 'ru' %}
<li class="header-pc-menu__list-li"> <li class="header-pc-menu__list-li">
<a href="/product-category/aksessuary/">{% if current_lang == 'ru' %}Аксессуары{% elseif current_lang == 'en' %}Accessories{% endif %}</a> <a href="/product-category/aksessuary/">{% if current_lang == 'ru' %}Аксессуары{% elseif current_lang == 'en' %}Accessories{% endif %}</a>
</li> </li>
{% endif %}
</ul> </ul>
</div> </div>
<div class="header-pc-menu__item"> <div class="header-pc-menu__item">

Loading…
Cancel
Save