add cookies
This commit is contained in:
10
archive.php
10
archive.php
@@ -1,4 +1,12 @@
|
|||||||
<?php get_header(); ?>
|
<?php get_header();
|
||||||
|
|
||||||
|
// Включить вывод всех ошибок
|
||||||
|
error_reporting(E_ALL);
|
||||||
|
ini_set('display_errors', 1);
|
||||||
|
ini_set('display_startup_errors', 1);
|
||||||
|
|
||||||
|
// Ваш код...
|
||||||
|
?>
|
||||||
<div class="content-middle articles-wrapper">
|
<div class="content-middle articles-wrapper">
|
||||||
<?php get_template_part('partials/rubrics-mobile'); ?>
|
<?php get_template_part('partials/rubrics-mobile'); ?>
|
||||||
<div class="section-title desktop">
|
<div class="section-title desktop">
|
||||||
|
|||||||
6
cookie-consent.php
Normal file
6
cookie-consent.php
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
<div id="cookie-consent-banner" class="cookie-consent" style="display: none;">
|
||||||
|
<div class="cookie-consent-content">
|
||||||
|
<p>Мы используем файлы cookie для улучшения работы сайта. Продолжая использование сайта, вы соглашаетесь с этим.</p>
|
||||||
|
<button id="cookie-consent-accept" class="cookie-consent-button">Принять</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@@ -18,6 +18,7 @@ import './styles/components/partner-item.css';
|
|||||||
import './styles/components/single-partner-item.css';
|
import './styles/components/single-partner-item.css';
|
||||||
import './styles/components/suggestion-item.css';
|
import './styles/components/suggestion-item.css';
|
||||||
import './styles/components/agro-informer.css';
|
import './styles/components/agro-informer.css';
|
||||||
|
import './styles/components/cookie-consent.css';
|
||||||
|
|
||||||
import './scripts/calendar.js';
|
import './scripts/calendar.js';
|
||||||
import './scripts/menu-vertical.js';
|
import './scripts/menu-vertical.js';
|
||||||
@@ -27,6 +28,7 @@ import './scripts/search-form.js';
|
|||||||
import './scripts/select.js';
|
import './scripts/select.js';
|
||||||
import './scripts/subscription-form.js';
|
import './scripts/subscription-form.js';
|
||||||
import './scripts/agroserver.js';
|
import './scripts/agroserver.js';
|
||||||
|
import './scripts/cookie-consent.js';
|
||||||
import './styles/components/about.css';
|
import './styles/components/about.css';
|
||||||
import './styles/components/banner.css';
|
import './styles/components/banner.css';
|
||||||
import './styles/components/breadcrumbs.css';
|
import './styles/components/breadcrumbs.css';
|
||||||
|
|||||||
13
frontend/src/scripts/cookie-consent.js
Normal file
13
frontend/src/scripts/cookie-consent.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
|
// Проверяем, дал ли пользователь согласие ранее
|
||||||
|
if (!localStorage.getItem('cookie_consent_accepted')) {
|
||||||
|
const banner = document.getElementById('cookie-consent-banner');
|
||||||
|
banner.style.display = 'block';
|
||||||
|
|
||||||
|
document.getElementById('cookie-consent-accept').addEventListener('click', function() {
|
||||||
|
// Сохраняем согласие в localStorage
|
||||||
|
localStorage.setItem('cookie_consent_accepted', 'true');
|
||||||
|
banner.style.display = 'none';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
36
frontend/src/styles/components/cookie-consent.css
Normal file
36
frontend/src/styles/components/cookie-consent.css
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
.cookie-consent {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
background: #333;
|
||||||
|
color: #fff;
|
||||||
|
padding: 15px;
|
||||||
|
z-index: 9999;
|
||||||
|
box-shadow: 0 -2px 10px rgba(0,0,0,0.2);
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cookie-consent-content {
|
||||||
|
max-width: 1200px;
|
||||||
|
margin: 0 auto;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cookie-consent-button {
|
||||||
|
background: #4CAF50;
|
||||||
|
color: white;
|
||||||
|
border: none;
|
||||||
|
padding: 8px 20px;
|
||||||
|
cursor: pointer;
|
||||||
|
border-radius: 4px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.cookie-consent-button:hover {
|
||||||
|
background: #45a049;
|
||||||
|
}
|
||||||
@@ -49,6 +49,5 @@ h3,
|
|||||||
|
|
||||||
.text-11 {
|
.text-11 {
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
font-size: 1.1rem;
|
|
||||||
line-height: 1.6rem;
|
line-height: 1.6rem;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1278,6 +1278,15 @@ function replace_first_figure_in_content($content) {
|
|||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function add_cookie_consent() {
|
||||||
|
if (!isset($_COOKIE['cookie_consent_accepted'])) {
|
||||||
|
get_template_part('cookie-consent');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_action('wp_footer', 'add_cookie_consent');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* убираем рубрики - Смена (7)
|
* убираем рубрики - Смена (7)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -18,6 +18,9 @@
|
|||||||
Подпишитесь на нашу рассылку и будьте в курсе всех новостей
|
Подпишитесь на нашу рассылку и будьте в курсе всех новостей
|
||||||
</p>
|
</p>
|
||||||
<?= do_shortcode('[contact-form-7 id="0ddb83c" title="Форма подписки" html_class="" html_id=""]') ?>
|
<?= do_shortcode('[contact-form-7 id="0ddb83c" title="Форма подписки" html_class="" html_id=""]') ?>
|
||||||
|
<div>
|
||||||
|
<p class="text-11"><br><p>Нажимая на кнопку «Подписаться», Вы соглашаетесь на обработку персональных данных в соответствии с <br><a class="contacts__policy text-11" href="/wp-content/uploads/2024/02/politika-konfedenczialnosti.pdf">«Политикой конфиденциальности»</a></p></p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php get_template_part('partials/latest-legislation-posts'); ?>
|
<?php get_template_part('partials/latest-legislation-posts'); ?>
|
||||||
|
|||||||
34
tag.php
Normal file
34
tag.php
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<?php get_header(); ?>
|
||||||
|
<div class="content-middle articles-wrapper">
|
||||||
|
<?php get_template_part('partials/rubrics-mobile'); ?>
|
||||||
|
<div class="section-title desktop">
|
||||||
|
<?php if (is_tag()) : ?>
|
||||||
|
<h1 class="section-title__title"><?= single_tag_title('', false) ?></h1>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
<div class="articles-preview">
|
||||||
|
<?php
|
||||||
|
$paged = (get_query_var('paged')) ? absint(get_query_var('paged')) : 1;
|
||||||
|
$args = array(
|
||||||
|
'post_type' => 'post',
|
||||||
|
'posts_per_page' => 13,
|
||||||
|
'paged' => $paged,
|
||||||
|
'tag_id' => get_queried_object_id() // Используем tag_id вместо category__in
|
||||||
|
);
|
||||||
|
$query = new WP_Query($args);
|
||||||
|
|
||||||
|
// Передаем query через глобальную переменную $wp_query, чтобы избежать ошибки
|
||||||
|
global $wp_query;
|
||||||
|
$original_query = $wp_query;
|
||||||
|
$wp_query = $query;
|
||||||
|
|
||||||
|
get_template_part('partials/post-list');
|
||||||
|
|
||||||
|
// Восстанавливаем оригинальный запрос
|
||||||
|
$wp_query = $original_query;
|
||||||
|
wp_reset_postdata();
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<?php custom_pagination(); ?>
|
||||||
|
</div>
|
||||||
|
<?php get_footer(); ?>
|
||||||
@@ -41,7 +41,8 @@ Template Name: Шаблон страницы контакты
|
|||||||
<div class="contacts__container">
|
<div class="contacts__container">
|
||||||
<h2 class="subtitle-18">Написать нам</h2>
|
<h2 class="subtitle-18">Написать нам</h2>
|
||||||
<?= do_shortcode('[contact-form-7 id="e39d3f5" title="Написать нам" html_class="contacts__form" html_id="contact__form"]')?>
|
<?= do_shortcode('[contact-form-7 id="e39d3f5" title="Написать нам" html_class="contacts__form" html_id="contact__form"]')?>
|
||||||
<p class="text-11"><?= $privacyPolicy['output_text']?></p>
|
<p class="text-11"><p>Нажимая на кнопку «Отправить», Вы соглашаетесь на обработку персональных данных в<br>
|
||||||
|
соответствии с <a class="contacts__policy text-11" href="/wp-content/uploads/2024/02/politika-konfedenczialnosti.pdf">«Политикой конфиденциальности»</a></p></p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a href="<?= home_url() ?>" class="articles-preview__show-next">На главную</a>
|
<a href="<?= home_url() ?>" class="articles-preview__show-next">На главную</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user