From 8da98af0dff74bfc6b200a7cc2935e4d0120a182 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 9 Jun 2025 20:08:45 +0300 Subject: [PATCH] =?UTF-8?q?Fix=20|=20=D0=BF=D0=BE=D1=84=D0=B8=D0=BA=D1=88?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=BA=D1=80=D0=B8=D1=82=D0=B8=D1=87=D0=B5=D1=81?= =?UTF-8?q?=D0=BA=D0=B8=D0=B9=20=D0=B1=D0=B0=D0=B3=20=D0=B2=20=D0=9B=D0=9A?= =?UTF-8?q?=20=D0=B8=20=D0=B1=D0=B0=D0=B3=20=D1=81=20=D0=B2=D1=8B=D0=B2?= =?UTF-8?q?=D0=BE=D0=B4=D0=BE=D0=BC=20=D1=84=D0=B8=D0=BB=D1=8C=D1=82=D1=80?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wp-content/themes/cosmopet/functions.php | 10 +- .../modules/layout/assets/js/gp-main.js | 20 -- .../cosmopet/static/front-page/js/main.js | 22 ++ .../front-page}/js/materialize.min.js | 0 .../front-page/template-front-page.php | 17 +- .../themes/cosmopet/templates/pet-card.twig | 48 ++-- .../cosmopet/templates/profile/profile.twig | 208 ++++++++++-------- 7 files changed, 173 insertions(+), 152 deletions(-) rename wp-content/themes/cosmopet/{modules/layout/assets => static/front-page}/js/materialize.min.js (100%) diff --git a/wp-content/themes/cosmopet/functions.php b/wp-content/themes/cosmopet/functions.php index 6294084..f6405ef 100644 --- a/wp-content/themes/cosmopet/functions.php +++ b/wp-content/themes/cosmopet/functions.php @@ -24,11 +24,11 @@ add_filter( 'timber/integrations', function ( array $integrations ): array { return $integrations; } ); -function theme_enqueue_scripts() { - // Swiper - wp_enqueue_script( 'gp-front-page-materialize', get_template_directory_uri() . '/modules/layout/assets/js/materialize.min.js', array(), null, true ); -} -add_action('wp_enqueue_scripts', 'theme_enqueue_scripts'); +// function theme_enqueue_scripts() { +// // Swiper +// wp_enqueue_script( 'gp-front-page-materialize', get_template_directory_uri() . '/modules/layout/assets/js/materialize.min.js', array(), null, true ); +// } +// add_action('wp_enqueue_scripts', 'theme_enqueue_scripts'); add_action('timber/init', function() { diff --git a/wp-content/themes/cosmopet/modules/layout/assets/js/gp-main.js b/wp-content/themes/cosmopet/modules/layout/assets/js/gp-main.js index 60c24ee..c10052e 100644 --- a/wp-content/themes/cosmopet/modules/layout/assets/js/gp-main.js +++ b/wp-content/themes/cosmopet/modules/layout/assets/js/gp-main.js @@ -450,26 +450,6 @@ if (document.querySelector('.header').classList.contains('white')) { // }); // }); -var slider = carousel_init(); - -function carousel_init() { - var carousel = document.querySelectorAll('.carousel'); - var options = { - numVisible: window.innerWidth > 421 ? 5 : 3, - indicators: false // Removed dots - }; - var instances = M.Carousel.init(carousel, options); - document.querySelectorAll('.about_slider_nav').forEach(btn => { - btn.addEventListener('click', function (e) { - if (e.target.closest('button').classList.contains('next')) { - instances[0].next(); - } else { - instances[0].prev(); - } - }); - }); - return instances; -} document.addEventListener('DOMContentLoaded', function () { const petsSlider = new Swiper(".discount_cosmodog__slider", { diff --git a/wp-content/themes/cosmopet/static/front-page/js/main.js b/wp-content/themes/cosmopet/static/front-page/js/main.js index 4a503b4..de71efc 100644 --- a/wp-content/themes/cosmopet/static/front-page/js/main.js +++ b/wp-content/themes/cosmopet/static/front-page/js/main.js @@ -596,3 +596,25 @@ document.addEventListener('DOMContentLoaded', function() { } // Close popup when clicking outside }); + + +var slider = carousel_init(); + +function carousel_init() { + var carousel = document.querySelectorAll('.carousel'); + var options = { + numVisible: window.innerWidth > 421 ? 5 : 3, + indicators: false // Removed dots + }; + var instances = M.Carousel.init(carousel, options); + document.querySelectorAll('.about_slider_nav').forEach(btn => { + btn.addEventListener('click', function (e) { + if (e.target.closest('button').classList.contains('next')) { + instances[0].next(); + } else { + instances[0].prev(); + } + }); + }); + return instances; +} \ No newline at end of file diff --git a/wp-content/themes/cosmopet/modules/layout/assets/js/materialize.min.js b/wp-content/themes/cosmopet/static/front-page/js/materialize.min.js similarity index 100% rename from wp-content/themes/cosmopet/modules/layout/assets/js/materialize.min.js rename to wp-content/themes/cosmopet/static/front-page/js/materialize.min.js diff --git a/wp-content/themes/cosmopet/templates/front-page/template-front-page.php b/wp-content/themes/cosmopet/templates/front-page/template-front-page.php index dcf4618..2d76143 100644 --- a/wp-content/themes/cosmopet/templates/front-page/template-front-page.php +++ b/wp-content/themes/cosmopet/templates/front-page/template-front-page.php @@ -8,14 +8,15 @@ false, 'version' => '1.0.0']); -}); - +function theme_enqueue_scripts() { + // Swiper + wp_enqueue_style('gp-front-page-carousel', get_template_directory_uri() . '/static/front-page/css/carousel.css'); + wp_enqueue_style('gp-front-page-materialize-css', get_template_directory_uri() . '/static/front-page/css/materialize.min.css'); + wp_enqueue_style('gp-front-page-style', get_template_directory_uri() . '/static/front-page/css/style.css'); + wp_enqueue_script( 'gp-front-page-materialize', get_template_directory_uri() . '/static/front-page/js/materialize.min.js', array(), null, true ); + wp_enqueue_script( 'gp-front-page-main', get_template_directory_uri() . '/static/front-page/js/main.js', array(), null, true ); +} +add_action('wp_enqueue_scripts', 'theme_enqueue_scripts'); // Создаем функцию для получения постов function get_blog_posts_data() { diff --git a/wp-content/themes/cosmopet/templates/pet-card.twig b/wp-content/themes/cosmopet/templates/pet-card.twig index f1d642c..b0c76fc 100644 --- a/wp-content/themes/cosmopet/templates/pet-card.twig +++ b/wp-content/themes/cosmopet/templates/pet-card.twig @@ -10,37 +10,37 @@
-

{{ pll_e('Breed') }}:

+

{{ fn('pll_e', 'Breed') }}:

{{ function('get_field', 'breed', pet_id) }}

-

{{ pll_e('Weight') }}:

+

{{ fn('pll_e','Weight') }}:

{% set weight_key = function('get_field', 'weight', pet_id) %} - {% if weight_key == 'below_1_5' %}{{ pll_e('from 0,5 kg to 1,5 kg') }} - {% elseif weight_key == '1_5-3' %}{{ pll_e('from 1.5 to 3 kg') }} - {% elseif weight_key == '3-5' %}{{ pll_e('from 3 to 5 kg') }} - {% elseif weight_key == '5-8' %}{{ pll_e('from 5 to 8 kg') }} - {% elseif weight_key == '8-11' %}{{ pll_e('from 8 to 11 kg') }} - {% elseif weight_key == '11-15' %}{{ pll_e('from 11 to 15 kg') }} - {% elseif weight_key == '15-20' %}{{ pll_e('from 15 to 20 kg') }} - {% elseif weight_key == '20-25' %}{{ pll_e('from 20 to 25 kg') }} - {% elseif weight_key == '25-35' %}{{ pll_e('from 25 to 35 kg') }} - {% elseif weight_key == 'more_35' %}{{ pll_e('More than 35 kg') }} + {% if weight_key == 'below_1_5' %}{{ fn('pll_e', 'from 0,5 kg to 1,5 kg') }} + {% elseif weight_key == '1_5-3' %}{{ fn('pll_e', 'from 1.5 to 3 kg') }} + {% elseif weight_key == '3-5' %}{{ fn('pll_e', 'from 3 to 5 kg') }} + {% elseif weight_key == '5-8' %}{{ fn('pll_e', 'from 5 to 8 kg') }} + {% elseif weight_key == '8-11' %}{{ fn('pll_e', 'from 8 to 11 kg') }} + {% elseif weight_key == '11-15' %}{{ fn('pll_e', 'from 11 to 15 kg') }} + {% elseif weight_key == '15-20' %}{{ fn('pll_e', 'from 15 to 20 kg') }} + {% elseif weight_key == '20-25' %}{{ fn('pll_e', 'from 20 to 25 kg') }} + {% elseif weight_key == '25-35' %}{{ fn('pll_e', 'from 25 to 35 kg') }} + {% elseif weight_key == 'more_35' %}{{ fn('pll_e', 'More than 35 kg') }} {% endif %}

{% if function('get_field', 'old', pet_id) %}
-

{{ pll_e('Age') }}:

+

{{ fn('pll_e', 'Age') }}:

{% set age_key = function('get_field', 'old', pet_id) %} - {% if age_key == 'normal' %}{{ pll_e('Adult (from 1 year to 7 years)') }} - {% elseif age_key == 'old' %}{{ pll_e('Elderly (from 7 to 12 years)') }} - {% elseif age_key == 'very_old' %}{{ pll_e('Aging (12 years and older)') }} - {% elseif age_key == 'baby' %}{{ pll_e('Baby (from 0 to 1 year)') }} + {% if age_key == 'normal' %}{{ fn('pll_e', 'Adult (from 1 year to 7 years)') }} + {% elseif age_key == 'old' %}{{ fn('pll_e', 'Elderly (from 7 to 12 years)') }} + {% elseif age_key == 'very_old' %}{{ fn('pll_e', 'Aging (12 years and older)') }} + {% elseif age_key == 'baby' %}{{ fn('pll_e', 'Baby (from 0 to 1 year)') }} {% endif %}

@@ -48,7 +48,7 @@ {% set month = function('get_field', 'month', pet_id) %} {% set zero = month < 10 ? '0' : '' %}
-

{{ pll_e('Birthday') }}:

+

{{ fn('pll_e', 'Birthday') }}:

{{ function('get_field', 'day', pet_id) }}.{{ zero }}{{ month }}.{{ function('get_field', 'year', pet_id) }}

@@ -56,25 +56,25 @@ {% endif %}
-

{{ pll_e('Activity') }}:

+

{{ fn('pll_e', 'Activity') }}:

{% set activity_key = function('get_field', 'activity', pet_id) %} - {% if activity_key == 'low' %}{{ pll_e('Low') }} - {% elseif activity_key == 'moderate' %}{{ pll_e('Moderate') }} - {% elseif activity_key == 'high' %}{{ pll_e('High') }} + {% if activity_key == 'low' %}{{ fn('pll_e', 'Low') }} + {% elseif activity_key == 'moderate' %}{{ fn('pll_e', 'Moderate') }} + {% elseif activity_key == 'high' %}{{ fn('pll_e', 'High') }} {% endif %}

{% if function('get_field', 'type', pet_id) == 'cat' and function('get_field', 'sterilized', pet_id) %}
-

{{ pll_e('Sterilized') }}

+

{{ fn('pll_e', 'Sterilized') }}

{% endif %}
diff --git a/wp-content/themes/cosmopet/templates/profile/profile.twig b/wp-content/themes/cosmopet/templates/profile/profile.twig index 59c67ea..7b79b8a 100644 --- a/wp-content/themes/cosmopet/templates/profile/profile.twig +++ b/wp-content/themes/cosmopet/templates/profile/profile.twig @@ -107,14 +107,9 @@ -{% endblock %} - - - -
+ +