GP_DV 4 months ago
commit 0ffa6707e0
  1. BIN
      .tmb/l1_d3AtY29udGVudC90aGVtZXMvY29zbW9wZXQtdGltYmVyL3NjcmVlbnNob3QucG5n1744272629.png
  2. 7
      wp-content/themes/cosmopet/functions.php
  3. 4
      wp-content/themes/cosmopet/modules/blog/assets/css/gp-style-desktop.css
  4. 10
      wp-content/themes/cosmopet/modules/blog/assets/css/gp-style-mobile.css
  5. 23
      wp-content/themes/cosmopet/modules/blog/components/most-read/component-controller.php
  6. 41
      wp-content/themes/cosmopet/modules/forms/assets/js/form.js
  7. 2
      wp-content/themes/cosmopet/modules/forms/module-controller.php
  8. 196
      wp-content/themes/cosmopet/modules/layout/assets/css/gp-style-core.css
  9. 14
      wp-content/themes/cosmopet/templates/404.twig
  10. 2
      wp-content/themes/cosmopet/templates/blog/author-banner.twig
  11. 72
      wp-content/themes/cosmopet/templates/blog/most-read.twig
  12. 55
      wp-content/themes/cosmopet/templates/footer.twig

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

@ -419,8 +419,6 @@ include_module('forms');
include_module('layout'); include_module('layout');
class WooProduct extends Timber\Post { class WooProduct extends Timber\Post {
protected $wc_product; protected $wc_product;
@ -526,11 +524,6 @@ function get_products() {
die(); die();
} }
function get_product_info ($id, $type) { function get_product_info ($id, $type) {
$product = wc_get_product( $id ); $product = wc_get_product( $id );
if ($type == 'price') { if ($type == 'price') {

@ -1,3 +1,7 @@
main{ main{
padding-top: 72px; padding-top: 72px;
}
.block-lists_text p {
font-size: 18px!important;
} }

@ -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);
}
}

@ -1,23 +1,22 @@
<?php <?php
add_filter('timber/context', function($context) { add_filter('timber/context', function($context) {
$current_category = get_queried_object(); // Получаем текущую категорию // Простой запрос для получения последних постов
$args = array( $args = array(
'post_type' => 'post', 'post_type' => 'post',
'posts_per_page' => 3, // Количество постов 'posts_per_page' => 3,
'orderby' => 'meta_value_num', 'orderby' => 'date',
'key' => 'post_views', // Поле плагина для подсчёта просмотров 'order' => 'DESC'
'order' => 'DESC', // Сортировка по убыванию
// Условие для фильтрации по текущей категории
'category__in' => $current_category ? array($current_category->term_id) : '',
); );
$most_read_query = new WP_Query($args); $most_read_query = new WP_Query($args);
$most_read = new Timber\PostQuery($most_read_query); $most_read = new Timber\PostQuery($most_read_query);
$context['most_read'] = $most_read; $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; return $context;
}); });

@ -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) { $('.form-process').submit(function(event) {
event.preventDefault(); event.preventDefault();
let validate = validateForm(this); let validate = validateForm(this);
@ -15,7 +51,8 @@ jQuery(document).ready(function($) {
formData: formData formData: formData
}, },
success: function(response) { success: function(response) {
alert(response.message); closeModals()
showModal('modal-success')
} }
}); });
} }

@ -75,7 +75,7 @@ class mindboxHandler extends FormHandler {
class emailHandler extends FormHandler { class emailHandler extends FormHandler {
public function handle($data) { public function handle($data) {
$to = 'fcs.andrew@gmail.com'; // Укажите email, на который нужно отправить данные $to = 'pro@cosmopet.shop'; // Укажите email, на который нужно отправить данные
$subject = 'Форма обработана'; // Тема письма $subject = 'Форма обработана'; // Тема письма
$message = $this->formatData($data); // Форматируем данные $message = $this->formatData($data); // Форматируем данные

@ -138,6 +138,10 @@ body {
flex-direction: column; flex-direction: column;
} }
.article-container a {
text-decoration: underline;
}
.indent h2 { .indent h2 {
max-width: 661px; 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 { .wrapper {
margin: 0 auto; margin: 0 auto;
max-width: 1600px; max-width: 1600px;
} }

@ -8,8 +8,6 @@
--gradient-turquoise: linear-gradient(90deg, #00C4B4, #00A3E0); --gradient-turquoise: linear-gradient(90deg, #00C4B4, #00A3E0);
} }
.container { .container {
text-align: center; text-align: center;
} }
@ -17,16 +15,12 @@
h1 { h1 {
font-size: 120px; font-size: 120px;
margin: 0; margin: 0;
background: var(--gradient-turquoise); background: #fff;
-webkit-background-clip: text; -webkit-background-clip: text;
-webkit-text-fill-color: transparent; -webkit-text-fill-color: transparent;
margin-top:50px;
} }
p {
font-size: 24px;
color: #000000;
margin: 20px 0;
}
.btn-home { .btn-home {
display: inline-block; display: inline-block;
@ -44,10 +38,10 @@
} }
</style> </style>
<div class="container"> <div class="container" style="height: 320px;">
{% if current_lang == 'ru' %} {% if current_lang == 'ru' %}
<h1>404</h1> <h1>404</h1>
<p>Данной страницы не существует</p> <p style="color: #ffffff;margin-top:20px;margin-bottom:20px;">Данной страницы не существует</p>
<a href="/" class="btn-home">На главную</a> <a href="/" class="btn-home">На главную</a>
{% elseif current_lang == 'en' %} {% elseif current_lang == 'en' %}
<h1>404</h1> <h1>404</h1>

@ -9,7 +9,7 @@
<img src="{{ current_path }}/assets/img/author-card-mb.png" alt="" class="author-content__img mb"> <img src="{{ current_path }}/assets/img/author-card-mb.png" alt="" class="author-content__img mb">
<h2 class="author-content__title">{{ function('pll_e', 'ПРЕДЛОЖИТЕ СТАТЬЮ ИЛИ СТАНЬТЕ АВТОРОМ') }} <h2 class="author-content__title">{{ function('pll_e', 'ПРЕДЛОЖИТЕ СТАТЬЮ ИЛИ СТАНЬТЕ АВТОРОМ') }}
</h2> </h2>
<a href="#" class="author-content__link">{{ function('pll_e', 'НАПИШИТЕ НАМ') }}</a> <button onclick="showModal('modal-offer')" class="author-content__link">{{ function('pll_e', 'НАПИШИТЕ НАМ') }}</и>
</div> </div>
</div> </div>
</section> </section>

@ -1,36 +1,50 @@
<div class="anons-best"> <div class="anons-best">
<h2 class="anons-best__title">{{ function('pll_e', 'САМЫЕ ЧИТАЕМЫЕ') }}:</h2> <h2 class="anons-best__title">{{ function('pll_e', 'САМЫЕ ЧИТАЕМЫЕ') }}:</h2>
<ul class="anons-best__card-wrap">
{% for post in most_read %} <!-- Отладочная информация -->
<li class="anons-best__card"> {% if debug_info %}
<ul class="anons-best__card-alerts"> <div style="display:none;">
{% for category in post.categories %} <p>Метаполя с просмотрами:</p>
<li> <ul>
<a href="{{ category.link }}">{{ category.name }}</a> {% for item in debug_info %}
</li> <li>ID: {{ item.post_id }}, Ключ: {{ item.meta_key }}, Значение: {{ item.meta_value }}</li>
{% endfor %} {% endfor %}
</ul> </ul>
<a href="{{post.link}}" class="main-img"> </div>
<img src="{{post.thumbnail.src}}" alt="{{post.thumbnail.alt}}"> {% endif %}
</a>
<div class="anons-best__card-body"> {% if most_read and most_read|length > 0 %}
<a href="{{post.link}}" class="anons-best__card-body__title">{{post.title}}</a> <ul class="anons-best__card-wrap">
<div class="anons-best__card-body__datas"> {% for post in most_read %}
<p>{{post.date}}</p> <li class="anons-best__card">
<p>{{ function('pll_e', 'время чтения') }}: {{post.reading_time}}</p> <ul class="anons-best__card-alerts">
<ul> {% for category in post.categories %}
{% if post.get_author_name %} <li>
<li class="logo"> <a href="{{ category.link }}">{{ category.name }}</a>
<img src="{{post.get_author_img}}" alt=""> </li>
{% endfor %}
</ul>
<a href="{{ post.link }}" class="main-img">
<img src="{{ post.thumbnail.src|default('https://via.placeholder.com/150') }}" alt="{{ post.thumbnail.alt|default(post.title) }}">
</a>
<div class="anons-best__card-body">
<a href="{{ post.link }}" class="anons-best__card-body__title">{{ post.title }}</a>
<div class="anons-best__card-body__datas">
<p>{{ post.date|date('d.m.Y') }}</p>
<p>{{ function('pll_e', 'время чтения') }}: {{ post.reading_time|default('5 мин') }}</p>
<ul>
{% if post.get_author_name %}
<li class="logo">
<img src="{{ post.get_author_img|default('https://via.placeholder.com/40') }}" alt="{{ post.get_author_name }}">
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
</div>
</div> </div>
</div> </li>
</li> {% endfor %}
{% endfor %} </ul>
</ul> {% else %}
</div> <p>Нет доступных постов для отображения.</p>
{% endif %}
</div>

@ -50,4 +50,57 @@
</div> </div>
</div> </div>
</footer> </footer>
<!-- Footer end -->
<!-- Footer end -->
{% verbatim %}
<div class="modal modal-success" style="display: none;">
<div class="modal-content">
<div class="close-button">&times;</div>
<h2 class="modal-title">ВАША ЗАЯВКА ПРИНЯТА!</h2>
<div class="modal-message">
<p>Спасибо! Сообщение успешно отправлено.</p>
<p>Наш менеджер скоро свяжемся с вами<br>для уточнения деталей.</p>
</div>
<div class="modal-button-container">
<a href="/" class="submit-button">Вернуться на сайт</a>
</div>
</div>
</div>
<div class="modal modal-offer" style="display: none;">
<div class="modal-content">
<div class="close-button">&times;</div>
<h2 class="modal-title">ПРЕДЛОЖИТЕ СТАТЬЮ</h2>
<p class="modal-subtitle">или станьте автором</p>
<form class="modal-form form-process" action="contact_form">
<div class="form-group full-width">
<input type="text" name="name" placeholder="Ваше имя *" required>
</div>
<div class="form-row">
<div class="form-group half-width">
<input type="tel" name="phone" placeholder="Телефон *" required>
</div>
<div class="form-group half-width">
<input type="text" name="telegram" placeholder="Telegram">
</div>
</div>
<div class="form-group half-width message-container">
<textarea name="message" placeholder="Текст обращения"></textarea>
</div>
<div class="form-group half-width">
<button type="submit" class="submit-button">Отправить</button>
</div>
<div class="author-image">
<img src="/wp-content/uploads/2025/04/rectangle.png" alt="Автор">
</div>
</form>
</div>
</div>
{% endverbatim %}

Loading…
Cancel
Save