From 960af33ef3e118d78ad996de43eaa2807e7ec58e Mon Sep 17 00:00:00 2001 From: Andrei-10 Date: Tue, 29 Apr 2025 09:17:57 +0000 Subject: [PATCH] dev_10_fixes (#10) Fix | bug fixes --- ...dGltYmVyL3NjcmVlbnNob3QucG5n1744272629.png | Bin 0 -> 1521 bytes wp-content/themes/cosmopet/functions.php | 7 - .../blog/assets/css/gp-style-desktop.css | 4 + .../blog/assets/css/gp-style-mobile.css | 10 + .../most-read/component-controller.php | 23 +- .../cosmopet/modules/forms/assets/js/form.js | 41 +++- .../modules/forms/module-controller.php | 2 +- .../layout/assets/css/gp-style-core.css | 196 +++++++++++++++++- wp-content/themes/cosmopet/templates/404.twig | 14 +- .../templates/blog/author-banner.twig | 2 +- .../cosmopet/templates/blog/most-read.twig | 72 ++++--- .../themes/cosmopet/templates/footer.twig | 55 ++++- 12 files changed, 362 insertions(+), 64 deletions(-) create mode 100644 .tmb/l1_d3AtY29udGVudC90aGVtZXMvY29zbW9wZXQtdGltYmVyL3NjcmVlbnNob3QucG5n1744272629.png diff --git a/.tmb/l1_d3AtY29udGVudC90aGVtZXMvY29zbW9wZXQtdGltYmVyL3NjcmVlbnNob3QucG5n1744272629.png b/.tmb/l1_d3AtY29udGVudC90aGVtZXMvY29zbW9wZXQtdGltYmVyL3NjcmVlbnNob3QucG5n1744272629.png new file mode 100644 index 0000000000000000000000000000000000000000..3f465d25beba6362700d345b9e5e2b703d04066f GIT binary patch literal 1521 zcmZ{kc{tPw7{`B_VO%rFIg=F$xhJOF7DHn&Qsd}QjboBpu^G8{G2^TdYD0(=m9n&Q zCx%?*N*9(K*oK!NKP&s#AEY5jggS!6a1dmTzlxbfkPv=xo`E2y*APTL z=z84&a|GE^?&9QX=L)sq&=CjSO)zyF8mD2o6K0!%w+b7t;8Or_FT;Qb)V0CP2z)Mq z;Z*2%hdK^Ci-gWvn23XCjW9U|i(HtFh3*wtKL>5`@ca>s--4kF(Ax*^U&E(J==cWf zUtld2`Z{3tDhvig+YzYugobJuZ-B|Oz&!=cZcsZ2AJd@!A-rS2<9Dz$21`$2rWA(f z;9CWZWx+s4Co_vPYDfk)&9XH_3325wv_cbta7e*qW zBLfDm!OIy~_J`&tz^j6HF3Xj6gE z4|P{R?=EM%TRWbC(@{o=3rm}6?_Vm{Vjo9|2^;1ID;~1ay};b&YM~M4LD+9%d_UUd zYXurBVn19UB#qq_b(lam$2%G6r=Oz#s6pdIP3}iy2t8FiMcWka$}cc#ll zmrVI+6R5VZWyQv*i6b7SVB%w(NGg(~~L?7UA zIE((00;eUJ0)}m^)>bwdWCsE@_F|1rijXGG(j;7%9*aWDT*-1vkG|DanD7Y`5`rbt z>5jQ%iesj=N18yrP;`NrSq9UjMIoWc;)z*0lroGY zvZuAJys%36=)~cWAHBsD2zwMlB=`&sS zHaKFYC%1_)UeqS;cvbJ{V{hKw@AqDp9jj(pq$FU)_MRPTV7`C!(d_D{k*dhv(dcyv zMRW8(&}zr^o9(Fu#^LjI`FgRKratGGd_xR~277dgBwd3& zu0#{l-9%F&QJc7_`%vgj(*7$11p4})4FCUv(eZ{W`~rUS0zL2~E7a>86S4LU^kynk d1HAm02bo^J;lFk=`F|KesCLe_4{R85{{jle(p~@n literal 0 HcmV?d00001 diff --git a/wp-content/themes/cosmopet/functions.php b/wp-content/themes/cosmopet/functions.php index a17c966..e3ad1dd 100644 --- a/wp-content/themes/cosmopet/functions.php +++ b/wp-content/themes/cosmopet/functions.php @@ -419,8 +419,6 @@ include_module('forms'); include_module('layout'); - - class WooProduct extends Timber\Post { protected $wc_product; @@ -526,11 +524,6 @@ function get_products() { die(); } - - - - - function get_product_info ($id, $type) { $product = wc_get_product( $id ); if ($type == 'price') { diff --git a/wp-content/themes/cosmopet/modules/blog/assets/css/gp-style-desktop.css b/wp-content/themes/cosmopet/modules/blog/assets/css/gp-style-desktop.css index 63c5937..c2d3155 100644 --- a/wp-content/themes/cosmopet/modules/blog/assets/css/gp-style-desktop.css +++ b/wp-content/themes/cosmopet/modules/blog/assets/css/gp-style-desktop.css @@ -1,3 +1,7 @@ main{ padding-top: 72px; +} + +.block-lists_text p { + font-size: 18px!important; } \ No newline at end of file diff --git a/wp-content/themes/cosmopet/modules/blog/assets/css/gp-style-mobile.css b/wp-content/themes/cosmopet/modules/blog/assets/css/gp-style-mobile.css index e69de29..05bb28b 100644 --- a/wp-content/themes/cosmopet/modules/blog/assets/css/gp-style-mobile.css +++ b/wp-content/themes/cosmopet/modules/blog/assets/css/gp-style-mobile.css @@ -0,0 +1,10 @@ +@media(max-width:600px) { + .article-content h2 { + max-width: 661px; + font-size: 24px!important; + line-height: 40px; + font-weight: bold; + text-transform: uppercase; + color: var(--grey-black); + } +} diff --git a/wp-content/themes/cosmopet/modules/blog/components/most-read/component-controller.php b/wp-content/themes/cosmopet/modules/blog/components/most-read/component-controller.php index b9bce3d..ce0af80 100644 --- a/wp-content/themes/cosmopet/modules/blog/components/most-read/component-controller.php +++ b/wp-content/themes/cosmopet/modules/blog/components/most-read/component-controller.php @@ -1,23 +1,22 @@ 'post', - 'posts_per_page' => 3, // Количество постов - 'orderby' => 'meta_value_num', - 'key' => 'post_views', // Поле плагина для подсчёта просмотров - 'order' => 'DESC', // Сортировка по убыванию - - // Условие для фильтрации по текущей категории - 'category__in' => $current_category ? array($current_category->term_id) : '', + 'posts_per_page' => 3, + 'orderby' => 'date', + 'order' => 'DESC' ); $most_read_query = new WP_Query($args); $most_read = new Timber\PostQuery($most_read_query); $context['most_read'] = $most_read; + + // Добавляем отладочную информацию + global $wpdb; + $debug_info = $wpdb->get_results("SELECT post_id, meta_key, meta_value FROM {$wpdb->postmeta} WHERE meta_key LIKE '%view%' LIMIT 5"); + $context['debug_info'] = $debug_info; + return $context; -}); +}); \ No newline at end of file diff --git a/wp-content/themes/cosmopet/modules/forms/assets/js/form.js b/wp-content/themes/cosmopet/modules/forms/assets/js/form.js index d79f7aa..0859e59 100644 --- a/wp-content/themes/cosmopet/modules/forms/assets/js/form.js +++ b/wp-content/themes/cosmopet/modules/forms/assets/js/form.js @@ -1,6 +1,42 @@ -jQuery(document).ready(function($) { +// Функция для показа модальных окон +function showModal(modalClass) { + const modal = document.querySelector('.' + modalClass); + if (modal) { + modal.style.display = 'flex'; + } + } + + // Функция для закрытия модальных окон + function closeModals() { + const modals = document.querySelectorAll('.modal'); + modals.forEach(modal => { + modal.style.display = 'none'; + }); + } + + // Инициализация после загрузки DOM + document.addEventListener('DOMContentLoaded', function() { + // Обработчики для кнопок закрытия + const closeButtons = document.querySelectorAll('.close-button'); + closeButtons.forEach(button => { + button.addEventListener('click', function() { + closeModals(); + }); + }); + + // Закрытие при клике вне контента + window.addEventListener('click', function(event) { + const modals = document.querySelectorAll('.modal'); + modals.forEach(modal => { + if (event.target === modal) { + modal.style.display = 'none'; + } + }); + }); + }); +jQuery(document).ready(function($) { $('.form-process').submit(function(event) { event.preventDefault(); let validate = validateForm(this); @@ -15,7 +51,8 @@ jQuery(document).ready(function($) { formData: formData }, success: function(response) { - alert(response.message); + closeModals() + showModal('modal-success') } }); } diff --git a/wp-content/themes/cosmopet/modules/forms/module-controller.php b/wp-content/themes/cosmopet/modules/forms/module-controller.php index 7a16dc8..b5aa7c3 100644 --- a/wp-content/themes/cosmopet/modules/forms/module-controller.php +++ b/wp-content/themes/cosmopet/modules/forms/module-controller.php @@ -75,7 +75,7 @@ class mindboxHandler extends FormHandler { class emailHandler extends FormHandler { public function handle($data) { - $to = 'fcs.andrew@gmail.com'; // Укажите email, на который нужно отправить данные + $to = 'pro@cosmopet.shop'; // Укажите email, на который нужно отправить данные $subject = 'Форма обработана'; // Тема письма $message = $this->formatData($data); // Форматируем данные diff --git a/wp-content/themes/cosmopet/modules/layout/assets/css/gp-style-core.css b/wp-content/themes/cosmopet/modules/layout/assets/css/gp-style-core.css index 8cb67ba..5541691 100644 --- a/wp-content/themes/cosmopet/modules/layout/assets/css/gp-style-core.css +++ b/wp-content/themes/cosmopet/modules/layout/assets/css/gp-style-core.css @@ -138,6 +138,10 @@ body { flex-direction: column; } +.article-container a { + text-decoration: underline; +} + .indent h2 { max-width: 661px; @@ -205,7 +209,197 @@ textarea{ } } +.modal { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.5); + display: flex; + justify-content: center; + align-items: center; + z-index: 1000; + } + + .modal-content { + position: relative; + width: 100%; + max-width: 600px; + padding: 40px; + border-radius: 20px; + text-align: center; + box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2); + } + + .modal-success .modal-content { + background-color: #fff; + background: url(/wp-content/uploads/2025/04/background.png) center center / contain no-repeat; + background-color: #fff; + background-position: bottom; + height: 500px; + display: flex; + flex-direction: column; + justify-content: center; + gap: 20px; + } + + .modal-success .modal-button-container { + margin-top: 200px; + } + + .modal-message { + font-size: 20px; + } + + .modal-success .modal-image { + position: absolute; + bottom: 0; + left: 50%; + transform: translateX(-50%); + } + + .close-button { + position: absolute; + top: 20px; + right: 20px; + font-size: 28px; + font-weight: bold; + cursor: pointer; + color: #000; + } + + .modal-title { + font-size: 32px; + font-weight: bold; + margin-bottom: 10px; + text-transform: uppercase; + } + + /* Стили для второго модального окна - Предложить статью */ + .modal-offer .modal-content { + background-color: #d6ff9f; + padding-bottom: 30px; + } + + .modal-subtitle { + font-size: 18px; + margin-bottom: 20px; + } + + .modal-form { + width: 100%; + } + + .form-group { + margin-bottom: 15px; + } + + .form-row { + display: flex; + gap: 10px; + } + + .full-width { + width: 100%; + } + + .half-width { + width: 100%; + max-width: 380px; + } + + .modal-offer input, textarea { + width: 100%!important; + padding: 12px 15px!important; + border: none!important; + border-radius: 20px!important; + font-size: 16px!important; + background-color: white!important; + } + + /* Контейнер для текстового поля и изображения автора */ + .message-container { + position: relative; + display: flex; + } + + textarea { + height: 100px; + resize: none; + padding-right: 130px; /* Оставляем место для изображения */ + } + + /* Стили для изображения автора */ + .author-image { + position: absolute; + right: 15px; + bottom: 0; + width: 130px; + height: 191px; + display: flex; + justify-content: flex-end; + align-items: flex-end; + } + + .author-image img { + max-width: 100%; + max-height: 100%; + } + + .submit-button { + width: 100%; + padding: 15px; + border: none; + border-radius: 25px; + background-color: #111; + color: white; + font-size: 18px; + font-weight: bold; + cursor: pointer; + transition: background-color 0.3s; + } + + .submit-button:hover { + background-color: #333; + } + + /* Адаптивность */ + @media (max-width: 768px) { + .modal-content { + width: 90%; + padding: 30px 20px; + } + + .modal-title { + font-size: 18px; + margin-bottom: 5px; + } + + .form-row { + flex-direction: column; + } + + .half-width { + width: 100%; + } + + .author-image { + width: 80px; + height: 80px; + right: 50%; + transform: translateX(50%); + bottom: 0; + top: -10%; + + } + + textarea { + padding-right: 90px; + } + } + .wrapper { margin: 0 auto; max-width: 1600px; -} \ No newline at end of file +} diff --git a/wp-content/themes/cosmopet/templates/404.twig b/wp-content/themes/cosmopet/templates/404.twig index c8773d1..ed83168 100644 --- a/wp-content/themes/cosmopet/templates/404.twig +++ b/wp-content/themes/cosmopet/templates/404.twig @@ -8,8 +8,6 @@ --gradient-turquoise: linear-gradient(90deg, #00C4B4, #00A3E0); } - - .container { text-align: center; } @@ -17,16 +15,12 @@ h1 { font-size: 120px; margin: 0; - background: var(--gradient-turquoise); + background: #fff; -webkit-background-clip: text; -webkit-text-fill-color: transparent; + margin-top:50px; } - p { - font-size: 24px; - color: #000000; - margin: 20px 0; - } .btn-home { display: inline-block; @@ -44,10 +38,10 @@ } -
+
{% if current_lang == 'ru' %}

404

-

Данной страницы не существует

+

Данной страницы не существует

На главную {% elseif current_lang == 'en' %}

404

diff --git a/wp-content/themes/cosmopet/templates/blog/author-banner.twig b/wp-content/themes/cosmopet/templates/blog/author-banner.twig index e249f88..8ce32b0 100644 --- a/wp-content/themes/cosmopet/templates/blog/author-banner.twig +++ b/wp-content/themes/cosmopet/templates/blog/author-banner.twig @@ -9,7 +9,7 @@

{{ function('pll_e', 'ПРЕДЛОЖИТЕ СТАТЬЮ ИЛИ СТАНЬТЕ АВТОРОМ') }}

- {{ function('pll_e', 'НАПИШИТЕ НАМ') }} +
\ No newline at end of file diff --git a/wp-content/themes/cosmopet/templates/blog/most-read.twig b/wp-content/themes/cosmopet/templates/blog/most-read.twig index 714c673..903c173 100644 --- a/wp-content/themes/cosmopet/templates/blog/most-read.twig +++ b/wp-content/themes/cosmopet/templates/blog/most-read.twig @@ -1,36 +1,50 @@

{{ function('pll_e', 'САМЫЕ ЧИТАЕМЫЕ') }}:

-
    - {% for post in most_read %} -
  • -
      - {% for category in post.categories %} -
    • - {{ category.name }} -
    • + + + {% if debug_info %} +
      +

      Метаполя с просмотрами:

      +
        + {% for item in debug_info %} +
      • ID: {{ item.post_id }}, Ключ: {{ item.meta_key }}, Значение: {{ item.meta_value }}
      • {% endfor %}
      - - {{post.thumbnail.alt}} - -
      - {{post.title}} -
      -

      {{post.date}}

      -

      {{ function('pll_e', 'время чтения') }}: {{post.reading_time}}

      -
        - {% if post.get_author_name %} -
      + {% endif %} + + {% if most_read and most_read|length > 0 %} +
        + {% for post in most_read %} +
      • + + + {{ post.thumbnail.alt|default(post.title) }} + +
        + {{ post.title }} +
        +

        {{ post.date|date('d.m.Y') }}

        +

        {{ function('pll_e', 'время чтения') }}: {{ post.reading_time|default('5 мин') }}

        +
          + {% if post.get_author_name %} + - {% endif %} -
        +
      +
      -
- - {% endfor %} - - - - + + {% endfor %} + + {% else %} +

Нет доступных постов для отображения.

+ {% endif %} + \ No newline at end of file diff --git a/wp-content/themes/cosmopet/templates/footer.twig b/wp-content/themes/cosmopet/templates/footer.twig index d7c908e..9598b8f 100644 --- a/wp-content/themes/cosmopet/templates/footer.twig +++ b/wp-content/themes/cosmopet/templates/footer.twig @@ -50,4 +50,57 @@ - \ No newline at end of file + + + + + {% verbatim %} + + + + + +{% endverbatim %}