Andrei | fix sitemode variable in twig templates didnt work

master
parent e83cd92339
commit a5235960da
  1. 1
      wp-content/themes/cosmopet/global-functions/multisite-functions.php
  2. 2
      wp-content/themes/cosmopet/templates/layout.twig

@ -27,6 +27,7 @@ add_filter('timber/twig', function (\Twig\Environment $twig) {
global $site_env; global $site_env;
$twig->addGlobal('site_region', $site_env->site_region); $twig->addGlobal('site_region', $site_env->site_region);
$twig->addGlobal('site_env', $site_env); $twig->addGlobal('site_env', $site_env);
$twig->addGlobal('site_mode', $site_env->site_mode);
$twig->addGlobal('header_scripts', get_field('header_scripts', 'option')); $twig->addGlobal('header_scripts', get_field('header_scripts', 'option'));
return $twig; return $twig;
}); });

@ -1,12 +1,14 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="ru"> <html lang="ru">
<head> <head>
{{ function('wp_head') }} {{ function('wp_head') }}
<title>{{ function('wp_title') }} </title> <title>{{ function('wp_title') }} </title>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
{% if site_mode == 'production' %} {% if site_mode == 'production' %}
{{ header_scripts }} {{ header_scripts }}
{% endif %} {% endif %}

Loading…
Cancel
Save