Compare commits

...

10 Commits

Author SHA1 Message Date
argoexpert press
f99899e53e update to ver 3-09-25 2025-09-03 00:13:32 +03:00
argoexpert press
60037c5091 correct author forest 2025-07-30 11:53:00 +03:00
argoexpert press
6228d8ba21 correct author page 2025-07-28 22:50:59 +03:00
329fff0696 add author avatar 2025-07-28 21:53:09 +03:00
argoexpert press
3207928a5c new format author and date 2025-07-25 21:05:36 +03:00
argoexpert press
6fab76bf4b correct paginator 2025-07-20 13:59:40 +03:00
argoexpert press
4c66dbc08b add new limit post in front and categrory 2025-07-17 00:47:54 +03:00
argoexpert press
5113bef6d8 correct period forest informer 2025-07-15 18:12:58 +03:00
argoexpert press
af2d883ced add left rfo informer 2025-07-14 15:03:04 +03:00
argoexpert press
30d9b0bdcc add rfo informers 2025-07-13 20:53:44 +03:00
27 changed files with 505 additions and 152 deletions

View File

@@ -1,4 +1,5 @@
<?php get_header(); ?> <?php get_header( 'rfo' ); ?>
<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">
@@ -8,21 +9,22 @@
$title = !empty($category) ? $category[0]->name : get_the_title(); $title = !empty($category) ? $category[0]->name : get_the_title();
?> ?>
<h1 class="section-title__title"><?= $title ?></h1> <h1 class="section-title__title"><?= $title ?></h1>
<h1><?php post_type_archive_title(); ?></h1>
<?php endif; ?> <?php endif; ?>
</div> </div>
<div class="articles-preview"> <div class="articles-preview">
<?php <?php
$paged = (get_query_var('paged')) ? absint(get_query_var('paged')) : 1; $paged = (get_query_var('paged')) ? absint(get_query_var('paged')) : 1;
$args = array( $args = array(
'post_type' => 'post', 'post_type' => 'spravochniki',
'posts_per_page' => 10, 'posts_per_page' => 10,
'paged' => $paged 'paged' => $paged
); );
$query = new WP_Query($args); $query = new WP_Query($args);
?> ?>
<?php get_template_part('partials/post-list', null, ['query' => $wp_query]); ?> <?php //get_template_part('partials/post-list', null, ['query' => $wp_query]); ?>
</div> </div>
<?php custom_pagination(); ?> <?php //custom_pagination(); ?>
</div> </div>
<?php get_footer(); ?> <?php get_footer( 'rfo' ) ; ?>

View File

@@ -5,8 +5,18 @@ error_reporting(E_ALL);
ini_set('display_errors', 1); ini_set('display_errors', 1);
ini_set('display_startup_errors', 1); ini_set('display_startup_errors', 1);
// Ваш код... // Ваш код...
?> ?>
<?php
$qo = get_queried_object();
echo '<pre>';
print_r($qo);
echo '</pre>';
?>
<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">

View File

@@ -2,10 +2,31 @@
<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-author">
<?php
// Получаем ID текущего автора
//$author_id = get_queried_object_id();
$author_id = get_the_author_meta('ID');
$avatar_id = get_user_meta($author_id, 'avatar_attachment_id', true);
if ($avatar_id) {
echo wp_get_attachment_image($avatar_id, 'medium', false, array('class' => 'author-avatar'));
} else {
// Fallback: Gravatar или дефолтное изображение
echo '<div class="author-avatar">' . get_avatar($author_id, 100, '', '', array('class' => 'avatar-round')) . '</div>';
}?>
<h1 class="section-title__title"><?= get_the_author(); ?></h1> <h1 class="section-title__title"><?= get_the_author(); ?></h1>
</div> </div>
<?php if (!is_paged()) {
$author_description = get_the_author_meta('description');
if (!empty($author_description)) {
echo '<div class="author-desc">';
echo nl2br(esc_html($author_description));
echo '</div>';
}
}?>
<div class="articles-preview"> <div class="articles-preview">
<?php <?php
$paged = (get_query_var('paged')) ? absint(get_query_var('paged')) : 1; $paged = (get_query_var('paged')) ? absint(get_query_var('paged')) : 1;
@@ -13,7 +34,7 @@
'post_type' => 'post', 'post_type' => 'post',
'posts_per_page' => 11, 'posts_per_page' => 11,
'paged' => $paged, 'paged' => $paged,
'author' => get_queried_object_id() 'author' => $author_id
); );
$query = new WP_Query($args); $query = new WP_Query($args);
?> ?>

View File

@@ -12,7 +12,7 @@ $has_video = ($current_category->slug === 'opinion') ? true : false;
?> ?>
<div class="rfo__rubric"><?=$current_category->name; ?></div> <h1 class="rfo__rubric"><?=$current_category->name; ?></h1>
<div class="articles-columns-rfo"> <div class="articles-columns-rfo">
<?php <?php
$paged = (get_query_var('paged')) ? absint(get_query_var('paged')) : 1; $paged = (get_query_var('paged')) ? absint(get_query_var('paged')) : 1;
@@ -52,6 +52,6 @@ $has_video = ($current_category->slug === 'opinion') ? true : false;
?> ?>
<?php get_template_part('rfo/post-list', null, ['query' => $query , 'has_video' => $has_video]); ?> <?php get_template_part('rfo/post-list', null, ['query' => $query , 'has_video' => $has_video]); ?>
</div> </div>
<?php custom_pagination( null, 'pagination pagination__rfo' ); ?> <?php custom_pagination( $query, 'pagination pagination__rfo' ); ?>
</div> </div>
<?php get_footer( 'rfo' ); ?> <?php get_footer( 'rfo' ); ?>

View File

@@ -11,7 +11,7 @@
$paged = (get_query_var('paged')) ? absint(get_query_var('paged')) : 1; $paged = (get_query_var('paged')) ? absint(get_query_var('paged')) : 1;
$args = array( $args = array(
'post_type' => 'post', 'post_type' => 'post',
'posts_per_page' => 13, 'posts_per_page' => 15,
'paged' => $paged, 'paged' => $paged,
'category__in' => get_queried_object_id() 'category__in' => get_queried_object_id()
); );
@@ -19,6 +19,6 @@
?> ?>
<?php get_template_part('partials/post-list', null, ['query' => $query]); ?> <?php get_template_part('partials/post-list', null, ['query' => $query]); ?>
</div> </div>
<?php custom_pagination(); ?> <?php custom_pagination( $query ); ?>
</div> </div>
<?php get_footer(); ?> <?php get_footer(); ?>

View File

@@ -18,29 +18,36 @@
'3' => [ '3' => [
'name' => 'Юлия Макеева', 'name' => 'Юлия Макеева',
'position' => 'Редактор сайта', 'position' => 'директор по медиапродуктам',
'image' => 'https://vetandlife.ru/wp-content/uploads/2021/12/makeeva.png' 'image' => 'https://vetandlife.ru/wp-content/uploads/2021/12/makeeva.png'
], ],
'4' => [ '4' => [
'name' => 'Александра Рыжкова',
'position' => 'замдиректора по медиапродуктам',
'image' => 'https://agroexpert.press/wp-content/uploads/2025/07/aleksandra-ryzhkova.jpg'
],
'5' => [
'name' => 'Елена Орехова', 'name' => 'Елена Орехова',
'position' => 'Заместитель редактора', 'position' => 'Редактор сайта',
'image' => 'https://agroexpert.press/wp-content/uploads/2024/04/orexova.jpg' 'image' => 'https://agroexpert.press/wp-content/uploads/2024/04/orexova.jpg'
], ],
'5' => [ '6' => [
'name' => 'Елена Каримова', 'name' => 'Елена Каримова',
'position' => 'Научный обозреватель', 'position' => 'Научный обозреватель',
'image' => 'https://agroexpert.press/wp-content/uploads/2024/04/karimova.jpg' 'image' => 'https://agroexpert.press/wp-content/uploads/2024/04/karimova.jpg'
], ],
'6' => [ '7' => [
'name' => 'Ильяс Левашов', 'name' => 'Ильяс Левашов',
'position' => 'Автор', 'position' => 'Автор',
'image' => 'https://vetandlife.ru/wp-content/uploads/2024/04/iilyas-levashov.jpg' 'image' => 'https://vetandlife.ru/wp-content/uploads/2024/04/iilyas-levashov.jpg'
], ],
'7' => [ '8' => [
'name' => 'Юлия Ликарчук', 'name' => 'Юлия Ликарчук',
'position' => 'Автор', 'position' => 'Автор',
'image' => 'https://vetandlife.ru/wp-content/uploads/2021/12/likarchyk.png' 'image' => 'https://vetandlife.ru/wp-content/uploads/2021/12/likarchyk.png'

View File

@@ -14,7 +14,7 @@ $extensionToClassMap = [
<div class="advert-item__block"> <div class="advert-item__block">
<? <?
$advertisers->the_post(); $advertisers->the_post();
the_content(); //the_content();
$documents = get_field('documents'); $documents = get_field('documents');
$documents = array_filter($documents, function($item) { $documents = array_filter($documents, function($item) {
return isset($item['document']) && $item['document'] !== false; return isset($item['document']) && $item['document'] !== false;
@@ -38,6 +38,25 @@ $extensionToClassMap = [
</div> </div>
</div> </div>
<? endif; ?> <? endif; ?>
<div class="article-single__content">
<p><strong>Кто мы?</strong></p>
<p>Федеральное деловое издание «Агроэксперт» входит в медиагруппу «Да Винчи Медиа», одну из ведущих отраслевых медиагрупп в России.</p>
<p><strong>В чем наше преимущество?</strong></p>
<p>Мы — единственное среди аграрных СМИ федеральное издание с собственным видеопродакшеном. Это позволяет запускать проекты полного цикла — от стратегии и креатива до производства и дистрибуции.</p>
<p><strong>Какие форматы доступны?</strong></p>
<p>Спецпроекты, нативные материалы, печатные публикации, digital-размещения, видео (съемка/постпродакшен), e-mail и соцсети, баннерные кампании, телеграм-интеграции, PR-поддержка.</p>
<p><strong>Работаете с мероприятиями?</strong></p>
<p>Да. Освещаем все отраслевые события и берем на себя информационное сопровождение мероприятий партнеров: анонс, пресс-офис, съемка/стрим, репортаж, пост-релиз.</p>
<p><strong>Бюджеты и сроки?</strong></p>
<p>Гибко — от разовых размещений до годовых программ. Базовые форматы — от 1 рабочего дня; спецпроекты и видео — от 23 недель.</p>
<p><strong>Как начать?</strong></p>
<p><a href="https://agroexpert.press/wp-content/uploads/2024/08/agroexpress_mediakit.pdf">Скачайте медиакит</a> или назначьте консультацию — подготовим предложение под ваши задачи и сроки.</p>
<p>Остались вопросы? Задавайте лично</p>
</div>
<div class="advert-item__block"> <div class="advert-item__block">
<h2 class="advert-item__block-title_margin-lg subtitle-18">Контакты</h2> <h2 class="advert-item__block-title_margin-lg subtitle-18">Контакты</h2>
<div class="advert-item__contacts"> <div class="advert-item__contacts">
@@ -46,10 +65,11 @@ $extensionToClassMap = [
<div class="advert-item__contact-item"> <div class="advert-item__contact-item">
<!--<div class="advert-item__avatar-container"><img src="https://agroexpert.press/wp-content/uploads/2024/09/polovincev.jpg" alt="Илья Половинцев" class="advert-item__contacts-avatar"></div>--> <!--<div class="advert-item__avatar-container"><img src="https://agroexpert.press/wp-content/uploads/2024/09/polovincev.jpg" alt="Илья Половинцев" class="advert-item__contacts-avatar"></div>-->
<div class="advert-item__contact-info"> <div class="advert-item__contact-info">
<p class="advert-item__contact-name subtitle-13">Елена Мишина</p> <p class="advert-item__contact-name subtitle-13">Елена Мишина, директор по развитию</p><br>
<p class="advert-item__contact-position text-13">По вопросам рекламы</p> <p class="advert-item__contact-name subtitle-13">Андрей Алексеев, менеджер по рекламе и спецпроектам</p><br>
<p class="advert-item__contact-phone subtitle-13">Тел: <a href="tel:79263663700"> +7 (926) 366 37 00</a></p> <p class="advert-item__contact-phone subtitle-13">Тел/WhatApp: <a href="tel:79263663700"> +7 (926) 366 37 00</a></p>
<p class="advert-item__contact-email text-13"><a href="mailto:pr@agroexpert.press">pr@agroexpert.press</a></p> <p class="advert-item__contact-email text-13"><a href="mailto:pr@agroexpert.press">pr@agroexpert.press</a></p>
<p class="advert-item__contact-email text-13"><a href="https://t.me/ad_vetandlife">@ad_vetandlife</a></p>
<div style="padding-top: 42px;"><a class="button" href="https://agroexpert.press/wp-content/uploads/2025/04/ae_kit_ed_250415_150204.pdf" target="_blank">Скачать медиакит</a></div> <div style="padding-top: 42px;"><a class="button" href="https://agroexpert.press/wp-content/uploads/2025/04/ae_kit_ed_250415_150204.pdf" target="_blank">Скачать медиакит</a></div>
</div> </div>
</div> </div>

View File

@@ -8,7 +8,7 @@
$args = array( $args = array(
'post_type' => 'post', // Или ваш пользовательский тип постов, если необходимо 'post_type' => 'post', // Или ваш пользовательский тип постов, если необходимо
'post__not_in' => [ $mainpost_id ], 'post__not_in' => [ $mainpost_id ],
'posts_per_page' => 12, // Количество постов на странице 'posts_per_page' => 16, // Количество постов на странице
'orderby' => 'date', // сортировка по дате 'orderby' => 'date', // сортировка по дате
'order' => 'DESC', // по убыванию (сначала новые) 'order' => 'DESC', // по убыванию (сначала новые)
'ignore_sticky_posts' => 1, 'ignore_sticky_posts' => 1,

View File

@@ -23,8 +23,14 @@ COPY vite.config.js vite.config.js
COPY ./certs /certs COPY ./certs /certs
# Открываем порт, который использует dev-сервер (например, Vite)
EXPOSE 5173
# Запускаем dev-сервер (например, `npm run dev` для Vite)
CMD ["npm", "run", "dev"]
# Определяем команду, которая будет выполняться при каждом запуске контейнера # Определяем команду, которая будет выполняться при каждом запуске контейнера
#CMD npm run build && chown -R 1000:1000 ./dist #CMD npm run build && chown -R 1000:1000 ./dist
#CMD ["npm", "run", "build"] #CMD ["npm", "run", "build"]
ENTRYPOINT ["npm", "run"] #ENTRYPOINT ["npm", "run"]

View File

@@ -21,6 +21,7 @@ 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 './styles/components/cookie-consent.css';
import './styles/components/author.css';
// rfo // rfo
@@ -34,7 +35,8 @@ import './styles/rfo/breadcrumbs.css';
import './styles/rfo/landing.css'; import './styles/rfo/landing.css';
import './styles/rfo/interview.css'; import './styles/rfo/interview.css';
//spravochniki
import './styles/spravochniki/spravochniki.css';
import './scripts/calendar.js'; import './scripts/calendar.js';
import './scripts/menu-vertical.js'; import './scripts/menu-vertical.js';

View File

@@ -19,6 +19,10 @@
display: none; display: none;
} }
.byline{
margin-bottom: 1.2rem;
}
@media (max-width: 1024px) { @media (max-width: 1024px) {
} }

View File

@@ -0,0 +1,19 @@
.section-title-author{
padding: 2.5rem 0 0 2.5rem;
display: flex;
align-items: center; /* центрирование по вертикали */
gap: 18px;
}
.author-avatar{
width: 10rem;
height: 10rem;
border-radius: 50%;
overflow: hidden;
position: relative;
}
.author-desc{
margin-top: 0.5rem;
padding: 1.5rem 1.25rem;
}

View File

@@ -22,11 +22,29 @@
overflow: hidden; overflow: hidden;
} }
.featured-image { .featured-image-dir-wrapper{
position: absolute;
top: 6px; /* Отступ сверху */
left: 6px; /* Отступ слева */
right: 6px; /* Отступ справа */
bottom: 33px; /* Оставляем место внизу для photo-credit-tag */
}
.featured-image,
.featured-image-dir {
border-radius: 14px; border-radius: 14px;
} }
.featured-image img { .featured-image-dir {
display: flex;
justify-content: center; /* Центрирует по горизонтали */
align-items: center; /* Центрирует по вертикали */
height: 100%;
}
.featured-image img{
width: 100%; width: 100%;
height: 100%; height: 100%;
object-fit: cover; /* Заполняем область с сохранением пропорций */ object-fit: cover; /* Заполняем область с сохранением пропорций */
@@ -36,6 +54,10 @@
filter: brightness(0.85); filter: brightness(0.85);
} }
.featured-image-dir img{
display: block;
}
.post-overlay { .post-overlay {
position: absolute; position: absolute;
bottom: 40px; /* Учитываем место для photo-credit-tag */ bottom: 40px; /* Учитываем место для photo-credit-tag */
@@ -72,7 +94,14 @@
mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 288 199" preserveAspectRatio="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.79424 0L279.205 0C284.042 0 287.999 3.94986 287.999 8.77791V34.6476V164.353V190.222C287.999 195.05 284.042 199 279.205 199H115.707C109.54 199 108.385 195.144 105.499 190.222L99.3918 179.805C97.3825 176.378 93.1269 173.509 89.5588 173.13H8.79422C3.95661 173.13 0 169.181 0 164.352V8.77756C0 3.94951 3.95663 0 8.79424 0Z" fill="black"/></svg>'); mask-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 288 199" preserveAspectRatio="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M8.79424 0L279.205 0C284.042 0 287.999 3.94986 287.999 8.77791V34.6476V164.353V190.222C287.999 195.05 284.042 199 279.205 199H115.707C109.54 199 108.385 195.144 105.499 190.222L99.3918 179.805C97.3825 176.378 93.1269 173.509 89.5588 173.13H8.79422C3.95661 173.13 0 169.181 0 164.352V8.77756C0 3.94951 3.95663 0 8.79424 0Z" fill="black"/></svg>');
mask-repeat: no-repeat; mask-repeat: no-repeat;
mask-size: 100% 100%; mask-size: 100% 100%;
margin-bottom: 22px;
} }
.featured-image-dir img{
width: 200px;
height: auto;
}
} }

View File

@@ -183,6 +183,7 @@
.header__inner_rfo{ .header__inner_rfo{
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
max-width: 100%;
} }
.menu-rfo { .menu-rfo {

View File

@@ -10,7 +10,7 @@
} }
.search-container-rfo input { .search-container-rfo input {
width: 100%; width: 100%;
height: 15px; height: 40px;
padding: 10px 0px 10px 15px; /* Правое поле больше для иконки */ padding: 10px 0px 10px 15px; /* Правое поле больше для иконки */
border: 1px solid #ddd; border: 1px solid #ddd;
border-radius: 50px; border-radius: 50px;

View File

@@ -4,6 +4,7 @@ setlocale(LC_TIME, 'ru_RU.UTF-8');
require get_template_directory() . '/inc/rubrics-menu.php'; // Рубрики в меню require get_template_directory() . '/inc/rubrics-menu.php'; // Рубрики в меню
require get_template_directory() . '/inc/special.php'; // Подключаем спецпроекты require get_template_directory() . '/inc/special.php'; // Подключаем спецпроекты
require get_template_directory() . '/inc/spravochniki.php'; // Подключаем справочники require get_template_directory() . '/inc/spravochniki.php'; // Подключаем справочники
require get_template_directory() . '/inc/avatar.php'; // Подключаем фото авторов
// Полностью отключить XML-RPC // Полностью отключить XML-RPC
add_filter( 'xmlrpc_enabled', '__return_false' ); add_filter( 'xmlrpc_enabled', '__return_false' );

View File

@@ -14,6 +14,7 @@
<meta name="msapplication-TileColor" content="#da532c"> <meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff"> <meta name="theme-color" content="#ffffff">
<meta name="yandex-verification" content="209d13da5a697e41" /> <meta name="yandex-verification" content="209d13da5a697e41" />
<meta name="msvalidate.01" content="3A6969690CBE2633E5EE3F5B0F7EF10D" />
<?php wp_head(); ?> <?php wp_head(); ?>
<!-- Yandex.Metrika counter --> <!-- Yandex.Metrika counter -->
<script type="text/javascript" > <script type="text/javascript" >
@@ -72,7 +73,7 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<nav class="nav header__nav"> <nav class="nav header__nav">
<?php get_template_part('partials/menu-primary'); ?> <?php get_template_part('partials/menu-primary'); ?>
</nav> </nav>
<div class="lang-switch"><a href="<?php echo home_url();?>/en/">EN</a></div> <!--<div class="lang-switch"><a href="<?php echo home_url();?>/en/">EN</a></div>-->
<div class="header__right"> <div class="header__right">
<div class="header__actions"> <div class="header__actions">
<a href="/search/?orderby=post_date&order=desc"> <a href="/search/?orderby=post_date&order=desc">

106
inc/avatar.php Normal file
View File

@@ -0,0 +1,106 @@
<?php
// 1. Добавляем enctype="multipart/form-data" к форме профиля
add_action('user_edit_form_tag', 'add_multipart_form_encoding');
function add_multipart_form_encoding() {
echo ' enctype="multipart/form-data"';
}
// 2. Добавляем поле для аватара + медиабиблиотеку
add_action('show_user_profile', 'extra_user_profile_fields');
add_action('edit_user_profile', 'extra_user_profile_fields');
function extra_user_profile_fields($user) {
wp_enqueue_media(); // Подключаем медиабиблиотеку
?>
<h3><?php _e("Custom Avatar", "your-textdomain"); ?></h3>
<table class="form-table">
<tr>
<th><label for="avatar"><?php _e("Avatar"); ?></label></th>
<td>
<!-- Поле для загрузки файла -->
<input type="file" name="avatar" id="avatar" />
<!-- Кнопка выбора из медиатеки -->
<button type="button" class="button" id="select-avatar"><?php _e('Select from Media Library', 'your-textdomain'); ?></button>
<input type="hidden" name="avatar_attachment_id" id="avatar_attachment_id" value="<?php echo esc_attr(get_user_meta($user->ID, 'avatar_attachment_id', true)); ?>" />
<?php
// Показываем текущий аватар
$attachment_id = get_user_meta($user->ID, 'avatar_attachment_id', true);
if ($attachment_id) {
echo wp_get_attachment_image($attachment_id, 'thumbnail', false, array(
'style' => 'display:block;margin-top:10px;',
'class' => 'avatar-preview'
));
echo '<p><input type="checkbox" name="remove_avatar" id="remove_avatar" /> <label for="remove_avatar">' . __('Remove avatar', 'your-textdomain') . '</label></p>';
}
?>
</td>
</tr>
</table>
<script>
jQuery(document).ready(function($) {
// Открываем медиабиблиотеку при клике
$('#select-avatar').click(function(e) {
e.preventDefault();
var frame = wp.media({
title: '<?php _e("Select Avatar", "your-textdomain"); ?>',
button: { text: '<?php _e("Use this image", "your-textdomain"); ?>' },
multiple: false
});
frame.on('select', function() {
var attachment = frame.state().get('selection').first().toJSON();
$('#avatar_attachment_id').val(attachment.id);
$('.avatar-preview').remove();
$(this).parent().append(
'<img src="' + attachment.sizes.thumbnail.url + '" style="display:block;margin-top:10px;" class="avatar-preview" />'
);
});
frame.open();
});
});
</script>
<?php
}
// 3. Сохраняем аватар
add_action('personal_options_update', 'save_extra_user_profile_fields');
add_action('edit_user_profile_update', 'save_extra_user_profile_fields');
function save_extra_user_profile_fields($user_id) {
if (!current_user_can('edit_user', $user_id)) return false;
// Удаление аватара
if (!empty($_POST['remove_avatar'])) {
delete_user_meta($user_id, 'avatar_attachment_id');
return;
}
// Загрузка нового файла
if (!empty($_FILES['avatar']['name'])) {
require_once(ABSPATH . 'wp-admin/includes/file.php');
$uploadedfile = $_FILES['avatar'];
$movefile = wp_handle_upload($uploadedfile, array('test_form' => false));
if ($movefile && !isset($movefile['error'])) {
$attachment_id = wp_insert_attachment(array(
'post_mime_type' => $movefile['type'],
'post_title' => preg_replace('/\.[^.]+$/', '', basename($movefile['file'])),
'post_status' => 'inherit'
), $movefile['file']);
if (!is_wp_error($attachment_id)) {
require_once(ABSPATH . 'wp-admin/includes/image.php');
wp_update_attachment_metadata($attachment_id, wp_generate_attachment_metadata($attachment_id, $movefile['file']));
update_user_meta($user_id, 'avatar_attachment_id', $attachment_id);
}
}
}
// Сохранение выбранного изображения из медиатеки
if (!empty($_POST['avatar_attachment_id'])) {
update_user_meta($user_id, 'avatar_attachment_id', intval($_POST['avatar_attachment_id']));
}
}

View File

@@ -1,6 +1,33 @@
<?php <?php
function agro_register_spravochniki_post_type() { function agro_register_spravochniki_post_type() {
// Таксономия: рубрики справочников
register_taxonomy('spravochnik_category', 'spravochniki', [
'labels' => [
'name' => 'Категории справочников',
'singular_name' => 'Категория справочника',
'search_items' => 'Искать категории',
'all_items' => 'Все категории',
'parent_item' => 'Родительская категория',
'parent_item_colon' => 'Родительская категория:',
'edit_item' => 'Редактировать категорию',
'update_item' => 'Обновить категорию',
'add_new_item' => 'Добавить новую категорию',
'new_item_name' => 'Новое имя категории',
'menu_name' => 'Категории',
],
'public' => true,
'hierarchical' => true,
'rewrite' => [
'slug' => 'spravochniki/category',
'with_front' => false,
'hierarchical' => true
],
'show_admin_column' => true,
'show_in_rest' => true,
]);
register_post_type('spravochniki', [ register_post_type('spravochniki', [
'labels' => [ 'labels' => [
'menu_name' => 'Справочники', 'menu_name' => 'Справочники',
@@ -16,38 +43,48 @@ function agro_register_spravochniki_post_type() {
'not_found_in_trash' => 'В корзине не найдено', 'not_found_in_trash' => 'В корзине не найдено',
], ],
'public' => true, 'public' => true,
'has_archive' => false, 'has_archive' => 'spravochniki',
'rewrite' => true, // переопределим вручную 'hierarchical' => false, // Для записей обычно false
'hierarchical' => false, 'rewrite' => [
'slug' => 'spravochniki',
'with_front' => false,
'pages' => true
],
'supports' => ['title', 'editor', 'excerpt', 'thumbnail'], 'supports' => ['title', 'editor', 'excerpt', 'thumbnail'],
'taxonomies' => ['spravochnik_category'], // прикрепим свою таксономию 'taxonomies' => ['spravochnik_category'],
'show_in_rest' => true, // поддержка Gutenberg 'show_in_rest' => true,
'menu_icon' => 'dashicons-book-alt', 'menu_icon' => 'dashicons-book-alt',
]); ]);
// Таксономия: рубрики справочников
register_taxonomy('spravochnik_category', 'spravochniki', [
'labels' => [
'name' => 'Справочники',
'singular_name' => 'Справочник',
'search_items' => 'Искать справочник',
'all_items' => 'Все справочники',
'parent_item' => 'Родительская рубрика',
'parent_item_colon' => 'Родительская рубрика:',
'edit_item' => 'Редактировать справочник',
'update_item' => 'Обновить справочник',
'add_new_item' => 'Добавить новый справочник',
'new_item_name' => 'Новое имя справочника',
'menu_name' => 'Справочники',
],
'public' => true,
'hierarchical' => true,
'rewrite' => false, // переопределим вручную
'show_in_rest' => true,
]);
}
add_action('init', 'agro_register_spravochniki_post_type');
}
add_action('init', 'agro_register_spravochniki_post_type', 0); // Приоритет 0 для ранней регистрации
// 3. Правила перезаписи (упрощенные)
function agro_custom_rewrite_rules() {
// Главная страница справочников
add_rewrite_rule('^spravochniki/?$', 'index.php?post_type=spravochniki', 'top');
// Пагинация архива
add_rewrite_rule('^spravochniki/page/([0-9]+)/?$', 'index.php?post_type=spravochniki&paged=$matches[1]', 'top');
// Одиночные записи
add_rewrite_rule('^spravochniki/([^/]+)/?$', 'index.php?spravochniki=$matches[1]', 'top');
// Категории 1 уровня
add_rewrite_rule('^spravochniki/category/([^/]+)/?$', 'index.php?spravochnik_category=$matches[1]', 'top');
// Категории 2 уровня (иерархические)
add_rewrite_rule('^spravochniki/category/([^/]+)/([^/]+)/?$', 'index.php?spravochnik_category=$matches[2]', 'top');
}
add_action('init', 'agro_custom_rewrite_rules', 20);
// Подзаголовок // Подзаголовок
@@ -73,6 +110,7 @@ function agro_add_spravochnik_subtitle_meta_box() {
add_action('add_meta_boxes', 'agro_add_spravochnik_subtitle_meta_box'); add_action('add_meta_boxes', 'agro_add_spravochnik_subtitle_meta_box');
function agro_spravochnik_subtitle_callback($post) { function agro_spravochnik_subtitle_callback($post) {
$subtitle = get_post_meta($post->ID, '_spravochnik_subtitle', true); $subtitle = get_post_meta($post->ID, '_spravochnik_subtitle', true);
echo '<input type="text" name="spravochnik_subtitle" value="' . esc_attr($subtitle) . '" style="width:100%;" />'; echo '<input type="text" name="spravochnik_subtitle" value="' . esc_attr($subtitle) . '" style="width:100%;" />';
@@ -86,5 +124,16 @@ function agro_save_spravochnik_subtitle($post_id) {
add_action('save_post', 'agro_save_spravochnik_subtitle'); add_action('save_post', 'agro_save_spravochnik_subtitle');
add_action('pre_get_posts', 'modify_taxonomy_query');
function modify_taxonomy_query($query) {
// Только для главного запроса таксономии
if (!is_admin() && $query->is_main_query() && is_tax('spravochnik_category')) {
$query->set('posts_per_page', 9); // Ваш лимит
$query->set('orderby', 'title'); // Пример сортировки
$query->set('order', 'ASC'); // Пример порядка
}
}

View File

@@ -22,7 +22,8 @@ $params = array(
'orderby' => 'rand', 'orderby' => 'rand',
'date_query' => array( 'date_query' => array(
array( array(
'after' => '3 month ago', //'after' => '3 month ago',
'after' => 'July 14, 2025',
'inclusive' => true, 'inclusive' => true,
), ),
), ),

View File

@@ -11,7 +11,8 @@ if ($query->have_posts()) {
$query->the_post(); $query->the_post();
if ( $post_counter == 1 ) : if ( $post_counter == 1 ) :
get_template_part('content', 'post-main-rfo', ['full_width' => $post_count === 1, 'has_video' => $has_video ]); //get_template_part('content', 'post-main-rfo', ['full_width' => $post_count === 1, 'has_video' => $has_video ]);
get_template_part('content', 'post-rfo', ['full_width' => $post_count === 1, 'has_video' => $has_video ]);
elseif ( $post_counter == 2) : elseif ( $post_counter == 2) :
get_template_part('content', 'post-rfo', ['full_width' => $post_count === 1 && $large_first_image, 'has_video' => $has_video]); get_template_part('content', 'post-rfo', ['full_width' => $post_count === 1 && $large_first_image, 'has_video' => $has_video]);
else:?> else:?>

58
rfo/rfo-informer.php Normal file
View File

@@ -0,0 +1,58 @@
<?php
// Задаем ID нужной категории (родительской)
$parent_cat_id = 3697; // РФО
// Получим ID подкатегорий
$subcats = get_categories( array(
'child_of' => $parent_cat_id,
'hide_empty' => false,
) );
// Собираем все ID: родительская + подкатегории
$category_ids = array( $parent_cat_id );
foreach ( $subcats as $cat ) {
$category_ids[] = $cat->term_id;
}
// Получаем 3 случайных поста из этих категорий
$params = array(
'category__in' => $category_ids,
'posts_per_page' => 3,
'post_status' => 'publish',
'orderby' => 'rand',
'date_query' => array(
array(
'after' => '1 month ago',
'inclusive' => true,
),
),
);
$random_posts = get_posts( $params );
// Если нашли посты
if ( $random_posts ) {
// Выбираем случайный один из трёх
$post = $random_posts[ array_rand( $random_posts ) ];
setup_postdata( $post );
?>
<div class="agro-widget<?if ($args['subclass'] !== '') echo ' '.$args['subclass'];?>">
<div class="agro-widget-maintitle"><a href="/rfo">Фумигация и защита растений</a></div>
<a href="<?php the_permalink(); ?>">
<?php if ( has_post_thumbnail() ) : ?>
<div>
<?php the_post_thumbnail('full'); ?>
</div>
<?php endif; ?>
<h3 class="agro-widget-title"><?php the_title(); ?></h3>
</a>
</div>
<?php
wp_reset_postdata();
}
?>

View File

@@ -38,8 +38,14 @@ if ( in_category('interviews') ) {
<div class="banner-left desktop"> <div class="banner-left desktop">
<?=krutilka_placement( 'left-desktop-1' );?> <?=krutilka_placement( 'left-desktop-1' );?>
</div> </div>
<?endif?>
<?php get_template_part('partials/forest-informer');?>
<?php get_template_part('partials/forest-informer');?>
<?php get_template_part('rfo/rfo-informer');?>
<?if (function_exists('krutilka_placement')):?>
<div class="banner-left desktop"> <div class="banner-left desktop">
<?=krutilka_placement( 'left-desktop-2' );?> <?=krutilka_placement( 'left-desktop-2' );?>

View File

@@ -26,19 +26,15 @@
$author = get_userdata(get_post_field('post_author')); $author = get_userdata(get_post_field('post_author'));
?> ?>
<?php if (!in_category('partners')) : ?>
<?php if ( $author AND $author->display_name !== 'agroexpert.press' ) : ?> <?php if ( $author AND $author->display_name !== 'agroexpert.press' ) : ?>
<div class="article-author"> <p class="byline">
<div class="article-author__name"> Автор&nbsp;<span class="article-author__name">
<a href="<?= get_author_posts_url($author->ID); ?>"> <a href="<?= get_author_posts_url($author->ID); ?>">
<?= $author->display_name; ?></a><br> <?=$author->display_name; ?></a>
<? if ( $author->description !== '' ):?> </span>
<?=$author->description?> </p>
<?endif?>
</div>
</div>
<?php endif; ?>
<?php endif; ?> <?php endif; ?>
<div class="article-single__content"> <div class="article-single__content">
<?php <?php
//$content = get_the_content(); //$content = get_the_content();

View File

@@ -1,49 +1,90 @@
<?php get_header(); ?> <?php get_header( 'rfo' ); ?>
<?php if (in_category('events')) : ?> <div class="content-rfo">
<?php get_template_part('single-events'); ?>
<? else : ?> <?php get_template_part('spravochniki/breadcrumbs'); ?>
<div class="content-middle articles-wrapper">
<?php get_template_part('partials/rubrics-mobile'); ?> <h1 class="rfo__rubric"><?php the_title(); ?></h1>
<div class="article-single"> <div class="article-single">
<div class="article-time article-single__time">
<?php if (!in_category('partners')) : ?>
<img src="<?= get_asset('/icons/time.svg'); ?>" alt="" />
<?php
$formatted_date = format_event_date();
?>
<?= $formatted_date; ?>
<? endif; ?> <div class="featured-post">
<?if ( has_post_thumbnail() ) :?>
<div class="featured-image-dir-wrapper">
<div class="featured-image-dir">
<!--<img src="https://agroexpert.press/wp-content/uploads/2024/06/korma-proizvodstvo.jpg" />-->
<?php the_post_thumbnail(); ?>
</div>
</div> </div>
<?php if (!in_category('partners')) : ?>
<div class="article-single__tag"><?=get_category_name(); ?></div>
<? endif; ?>
<h1 class="article-single__title">
<?php the_title(); ?>
</h1>
<div class="article-single__content"> <div class="photo-credit-tag">
<span><?the_post_thumbnail_caption()?></span>
</div>
<? endif; ?>
</div>
<div class="article-single--rfo">
<div class="article-info--rfo">
<div class="article-info-element--rfo">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_362_2372)">
<circle cx="12" cy="12" r="9" stroke="#006842" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
<path d="M12 8V13.3333H16.3333" stroke="#006842" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" />
</g>
<defs>
<clipPath id="clip0_362_2372">
<rect width="24" height="24" fill="white" />
</clipPath>
</defs>
</svg>
<div><?=calculate_reading_time()?> на прочтение</div>
</div>
</div>
<div class="article-text--rfo">
<?php <?php
//$content = get_the_content(); //$content = get_the_content();
$post_id = get_the_ID(); $post_id = get_the_ID();
if ( $post_id == 26011 ) {
the_content(); //echo replace_first_figure_in_content($content);
} else {
$content = apply_filters('the_content', get_the_content()); $content = apply_filters('the_content', get_the_content());
echo replace_first_figure_in_content($content); echo delete_first_figure_in_content($content);?>
}
//the_content(); ?> <div class="social-post--rfo">
<div class="article-social">Подписывайтесь на нас в <a href="https://dzen.ru/agroexpert_press?favid=254170145" target="_blank">Дзен</a> и <a href="https://t.me/agroexpert_press" target="_blank">Telegram</a></div> <div class="social-post-info--rfo">Подписывайтесь на нас в <a href="https://dzen.ru/agroexpert_press?favid=254170145" target="_blank">Дзен</a> и <a href="https://t.me/agroexpert_press" target="_blank">Telegram</a></div>
<div class="social-post-icons--rfo">
<svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="36" height="36" rx="10" fill="white" />
<path d="M19.7357 19.7357C18.3214 21.195 18.2186 23.0143 18.0964 27C21.8121 27 24.3771 26.9871 25.7014 25.7014C26.9871 24.3771 27 21.69 27 18.0964C23.0143 18.225 21.195 18.3214 19.7357 19.7357ZM9 18.0964C9 21.69 9.01286 24.3771 10.2986 25.7014C11.6229 26.9871 14.1879 27 17.9036 27C17.775 23.0143 17.6786 21.195 16.2643 19.7357C14.805 18.3214 12.9857 18.2186 9 18.0964ZM17.9036 9C14.1943 9 11.6229 9.01286 10.2986 10.2986C9.01286 11.6229 9 14.31 9 17.9036C12.9857 17.775 14.805 17.6786 16.2643 16.2643C17.6786 14.805 17.7814 12.9857 17.9036 9ZM19.7357 16.2643C18.3214 14.805 18.2186 12.9857 18.0964 9C21.8121 9 24.3771 9.01286 25.7014 10.2986C26.9871 11.6229 27 14.31 27 17.9036C23.0143 17.775 21.195 17.6786 19.7357 16.2643Z" fill="black" />
<path d="M27 18.0964V17.9036C23.0143 17.775 21.195 17.6786 19.7357 16.2643C18.3214 14.805 18.2186 12.9857 18.0964 9H17.9036C17.775 12.9857 17.6786 14.805 16.2643 16.2643C14.805 17.6786 12.9857 17.7814 9 17.9036V18.0964C12.9857 18.225 14.805 18.3214 16.2643 19.7357C17.6786 21.195 17.7814 23.0143 17.9036 27H18.0964C18.225 23.0143 18.3214 21.195 19.7357 19.7357C21.195 18.3214 23.0143 18.2186 27 18.0964Z" fill="white" />
</svg>
<svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="36" height="36" rx="10" fill="white" />
<path d="M26.1 11.3418L23.3951 25.4628C23.3951 25.4628 23.0167 26.4419 21.977 25.9724L15.7361 21.0171L15.7072 21.0025C16.5502 20.2187 23.0872 14.1322 23.3729 13.8563C23.8151 13.429 23.5406 13.1747 23.027 13.4974L13.3711 19.8475L9.64587 18.5495C9.64587 18.5495 9.05963 18.3335 9.00323 17.864C8.94609 17.3937 9.66517 17.1393 9.66517 17.1393L24.8518 10.9699C24.8518 10.9699 26.1 10.4019 26.1 11.3418Z" fill="black" />
</svg>
</div> </div>
</div> </div>
</div>
</div>
</div>
<?php // get_template_part('partials/rtb-single'); ?> <?php // get_template_part('partials/rtb-single'); ?>
<?php get_template_part('partials/featured-posts'); ?> <?php get_template_part('partials/featured-posts'); ?>
<?php if (!in_category('partners')) : ?> <?php if (!in_category('partners')) : ?>
<?php get_template_part('partials/related-posts'); ?> <?php get_template_part('rfo/related-posts'); ?>
<? else : ?> <? else : ?>
<div class="section-title"> <div class="section-title">
<h2 class="section-title__title subtitle-18">Еще по теме</h2> <h2 class="section-title__title subtitle-18">Еще по теме</h2>
@@ -68,12 +109,14 @@
<? endforeach; ?> <? endforeach; ?>
</div> </div>
<? endif; ?> <? endif; ?>
<a href="<?= home_url(); ?>" class="articles-preview__show-next desktop">На главную</a> <div class="article-show-next__rfo">
<a href="<?= home_url(); ?>/rfo">На главную</a>
</div>
<div class="articles__spacer-container"> <div class="articles__spacer-container">
<div class="articles__spacer"></div> <div class="articles__spacer"></div>
<div class="articles__spacer"></div> <div class="articles__spacer"></div>
</div> </div>
</div> </div>
<? endif; ?>
<?php get_footer(); ?>
<?php get_footer( 'rfo' ); ?>

View File

@@ -13,8 +13,9 @@
<?php <?php
$formatted_date = format_event_date(); $formatted_date = format_event_date();
?> ?>
<time datetime="<?php echo get_the_date('c'); ?>">
<?= $formatted_date; ?> <?= $formatted_date; ?>
</time>
<? endif; ?> <? endif; ?>
</div> </div>
<?php if (!in_category('partners')) : ?> <?php if (!in_category('partners')) : ?>
@@ -29,15 +30,12 @@
<?php if (!in_category('partners')) : ?> <?php if (!in_category('partners')) : ?>
<?php if ( $author AND $author->display_name !== 'agroexpert.press' AND $author->display_name !== 'Анна Купровская') : ?> <?php if ( $author AND $author->display_name !== 'agroexpert.press' AND $author->display_name !== 'Анна Купровская') : ?>
<div class="article-author"> <p class="byline">
<div class="article-author__name"> Автор&nbsp;<span class="article-author__name">
<a href="<?= get_author_posts_url($author->ID); ?>"> <a href="<?= get_author_posts_url($author->ID); ?>">
<?= $author->display_name; ?></a><br> <?=$author->display_name; ?></a>
<? if ( $author->description !== '' ):?> </span>
<?=$author->description?> </p>
<?endif?>
</div>
</div>
<?php endif; ?> <?php endif; ?>
<?php endif; ?> <?php endif; ?>
<div class="article-single__content"> <div class="article-single__content">

View File

@@ -1,28 +0,0 @@
<?php get_header(); ?>
<div class="content-middle articles-wrapper">
<?php get_template_part('partials/rubrics-mobile'); ?>
<div class="section-title desktop">
<?php
if (is_category()):
$category = get_the_category();
$title = !empty($category) ? $category[0]->name : get_the_title();
?>
<h1 class="section-title__title"><?= $title ?></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' => 10,
'paged' => $paged
);
$query = new WP_Query($args);
?>
<?php get_template_part('partials/post-list', null, ['query' => $wp_query]); ?>
</div>
<?php custom_pagination(); ?>
</div>
<?php get_footer(); ?>