From ffca487440602922be4c135e81849465d0a254be Mon Sep 17 00:00:00 2001 From: maksim Date: Sat, 2 Aug 2025 14:01:03 +0300 Subject: [PATCH] Andrei | fix texts lang in static pages --- .../template-new-front-page.php | 129 ++++++++++++++++++ .../cosmopet/templates/_pages/about.twig | 2 +- .../cosmopet/templates/_pages/production.twig | 7 +- .../templates/shop/product-single_page.twig | 0 4 files changed, 132 insertions(+), 6 deletions(-) create mode 100644 wp-content/themes/cosmopet/modules/static-pages/new-front-page copy/template-new-front-page.php create mode 100644 wp-content/themes/cosmopet/templates/shop/product-single_page.twig diff --git a/wp-content/themes/cosmopet/modules/static-pages/new-front-page copy/template-new-front-page.php b/wp-content/themes/cosmopet/modules/static-pages/new-front-page copy/template-new-front-page.php new file mode 100644 index 0000000..5b2108f --- /dev/null +++ b/wp-content/themes/cosmopet/modules/static-pages/new-front-page copy/template-new-front-page.php @@ -0,0 +1,129 @@ + 'p_reviews', + 'numberposts' => -1, + 'meta_key' => 'food_enable', + 'meta_value' => true, + 'meta_compare' => '=' +)); + +$reviews_treats_query = get_posts(array( + 'post_type' => 'p_reviews', + 'numberposts' => -1, + 'meta_key' => 'treats_enable', + 'meta_value' => true, + 'meta_compare' => '=' +)); + +$context = Timber::context(); + +if (function_exists('get_field')) { + //products + $context['reviews_treats_query'] = $reviews_treats_query; + $context['reviews_food_query'] = $reviews_food_query; + // main + $context['main_slider'] = get_field('main_slider'); + // about + $context['main_about_title'] = get_field('main_about-title'); + $context['main_about_image'] = get_field('main_about-image'); + $context['main_about_text'] = get_field('main_about-text'); + $context['main_about_banner_bg'] = get_field('main_about-banner-bg'); + $context['main_about_banner_title'] = get_field('main_about-banner-title'); + $context['main_about_banner_descr'] = get_field('main_about-banner-descr'); + // why + $context['main_why_title'] = get_field('main_why-title'); + $context['main_why_items'] = get_field('main_why-items'); + $context['main_why_text'] = get_field('main_why-text'); + $context['main_why_logos'] = get_field('main_why-logos'); + // ingredients + $context['main_ingredients_title'] = get_field('main_ingredients-title'); + $context['main_ingredients_slider'] = get_field('main_ingredients-slider'); + // specialists + $context['main_specialists_title'] = get_field('main_specialists-title'); + $context['main_specialists_items'] = get_field('main_specialists-items'); + // cosmopetx + $context['other_post'] = Timber::get_post(383); // Загружаем пост с ID 383 + //quiz + $context['q_title'] = get_field('q_title'); + $context['reviews_title'] = get_field('reviews_title'); + $context['q_1'] = get_field('q_1', 383); + $context['q_2'] = get_field('q_2', 383); + $context['q_3'] = get_field('q_3', 383); + $context['q_4'] = get_field('q_4', 383); + $context['q_5'] = get_field('q_5', 383); + + // + + $context['food_list'] = get_field('featured_food'); + $context['treats_list'] = get_field('featured_treats'); +} + +try { + Timber::render('_pages/new-front-page.twig', $context); // Рендерим отдельный Twig-шаблон +} catch (Exception $e) { + error_log('Ошибка рендеринга: ' . $e->getMessage()); + echo 'Произошла ошибка при рендеринге шаблона. Проверь логи: ' . $e->getMessage(); +} +?> \ No newline at end of file diff --git a/wp-content/themes/cosmopet/templates/_pages/about.twig b/wp-content/themes/cosmopet/templates/_pages/about.twig index e0a8047..7e8fb54 100644 --- a/wp-content/themes/cosmopet/templates/_pages/about.twig +++ b/wp-content/themes/cosmopet/templates/_pages/about.twig @@ -22,7 +22,7 @@
{{text}}

{{ adv_title }}

-

Due to the unique structure of the entoprotein, it is unlikely to cause allergies. Additionally, since animals have not encountered this type of protein during evolution, it does not trigger allergic reactions in pets.

+

{{adv_text}}

{% for item in adv %}
diff --git a/wp-content/themes/cosmopet/templates/_pages/production.twig b/wp-content/themes/cosmopet/templates/_pages/production.twig index 9f7a837..0cac6ff 100644 --- a/wp-content/themes/cosmopet/templates/_pages/production.twig +++ b/wp-content/themes/cosmopet/templates/_pages/production.twig @@ -25,11 +25,8 @@ {% for item in desc %}

{{ item.text }}

{% endfor %} - {% if site_region == 'ru' %} -

COSMOPET PRODUCTION IS BASED ON A UNIQUE TECHNOLOGICAL PROCESS WHICH HAS NO ANALOGUES IN THE WORLD.

- {% endif %}
-
{{ function('pll_e', 'PRODUCTION STAGES') }}
+
{{ function('pll_e', 'ЭТАПЫ ПРОИЗВОДСТВА') }}
{% if steps_1[0] is defined %} @@ -181,7 +178,7 @@
-
{{ function('pll_e', 'Stages of feed production') }}
+
{{ function('pll_e', 'Этапы производства корма') }}
{% for item in steps_2 %} diff --git a/wp-content/themes/cosmopet/templates/shop/product-single_page.twig b/wp-content/themes/cosmopet/templates/shop/product-single_page.twig new file mode 100644 index 0000000..e69de29