add new adv plugin and suppoer webp
This commit is contained in:
@@ -47,9 +47,10 @@ $extensionToClassMap = [
|
|||||||
<!--<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>
|
||||||
<p class="advert-item__contact-position text-13"><?= $contact['position'] ?></p>
|
<p class="advert-item__contact-position text-13">По вопросам рекламы</p>
|
||||||
<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">Тел: <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>
|
||||||
|
<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>
|
||||||
<? endforeach; ?>
|
<? endforeach; ?>
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ $class = $full_width ? 'article-item article-item--lg' : 'article-item';
|
|||||||
?>
|
?>
|
||||||
<div class="<?= $class; ?>">
|
<div class="<?= $class; ?>">
|
||||||
<a href="<?php the_permalink(); ?>" class="article-item__image-container">
|
<a href="<?php the_permalink(); ?>" class="article-item__image-container">
|
||||||
<?= show_post_image(); ?>
|
<?=render_webp_picture_by_post(); ?>
|
||||||
</a>
|
</a>
|
||||||
<div class="article-item__text">
|
<div class="article-item__text">
|
||||||
<div class="article-time">
|
<div class="article-time">
|
||||||
|
|||||||
@@ -14,22 +14,39 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.content-right {
|
.content-right {
|
||||||
grid-area: right;
|
grid-area: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.content-right__link-item {
|
.content-right__link-item {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
|
|
||||||
=======
|
|
||||||
>>>>>>> 8c3c602de751cb17721311afac451c4109c6924d
|
|
||||||
ul.wp-block-list li{
|
ul.wp-block-list li{
|
||||||
display: block;
|
display: block;
|
||||||
padding: 4px 0;
|
padding: 4px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.about p {
|
||||||
|
margin-bottom: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.content-middle picture,
|
||||||
|
.content-middle img,
|
||||||
|
.content-middle picture img {
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-single IMG{
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.image-caption{
|
||||||
|
margin: 12px 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 1439px) {
|
@media (max-width: 1439px) {
|
||||||
.content {
|
.content {
|
||||||
grid-template-columns: 36.4rem 1fr;
|
grid-template-columns: 36.4rem 1fr;
|
||||||
@@ -206,7 +223,7 @@ ul.wp-block-list li{
|
|||||||
|
|
||||||
.banner-left {
|
.banner-left {
|
||||||
margin: 2.5rem auto 0;
|
margin: 2.5rem auto 0;
|
||||||
height: 40rem;
|
/*height: 40rem;*/
|
||||||
width: 24rem;
|
width: 24rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1180,5 +1180,79 @@ function restrict_author_publish_posts( $data ) {
|
|||||||
}
|
}
|
||||||
add_filter( 'wp_insert_post_data', 'restrict_author_publish_posts' );
|
add_filter( 'wp_insert_post_data', 'restrict_author_publish_posts' );
|
||||||
|
|
||||||
|
function replace_first_figure_in_content($content) {
|
||||||
|
|
||||||
|
global $post;
|
||||||
|
|
||||||
|
if (!isset($post->ID)) {
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
|
|
||||||
|
$startPos = strpos($content, '<figure');
|
||||||
|
if ($startPos === false) {
|
||||||
|
return $content; // Если <figure> не найдено, возвращаем исходный контент
|
||||||
|
}
|
||||||
|
|
||||||
|
$endPos = strpos($content, '</figure>', $startPos);
|
||||||
|
if ($endPos === false) {
|
||||||
|
return $content; // Если </figure> не найдено, возвращаем исходный контент
|
||||||
|
}
|
||||||
|
|
||||||
|
// Рассчитываем длину части, которую нужно заменить
|
||||||
|
$endPos += strlen('</figure>'); // Двигаем указатель на конец тега </figure>
|
||||||
|
$figureHtml = substr($content, $startPos, $endPos - $startPos);
|
||||||
|
|
||||||
|
|
||||||
|
// Генерируем HTML изображения
|
||||||
|
$replacement = render_webp_picture_by_post($post->ID);
|
||||||
|
|
||||||
|
// Ищем <figcaption> внутри исходного фрагмента
|
||||||
|
$caption = '';
|
||||||
|
if (preg_match('/<figcaption.*?>(.*?)<\/figcaption>/is', $content, $caption_match)) {
|
||||||
|
$caption = '<div class="image-caption">'.$caption_match[1].'</div>'; // только содержимое
|
||||||
|
}
|
||||||
|
|
||||||
|
$replacement .= $caption;
|
||||||
|
|
||||||
|
// Заменяем найденный кусок на новый HTML
|
||||||
|
$newContent = substr_replace($content, $replacement, $startPos, $endPos - $startPos);
|
||||||
|
|
||||||
|
|
||||||
|
return $newContent;
|
||||||
|
|
||||||
|
|
||||||
|
// Ищем первое <figure>...</figure>
|
||||||
|
if (preg_match('/<figure.*?>.*?<\/figure>/is', $content, $match)) {
|
||||||
|
$original_figure = $match[0];
|
||||||
|
|
||||||
|
// Извлекаем <figcaption> (если есть)
|
||||||
|
$caption = '';
|
||||||
|
if (preg_match('/<figcaption.*?>(.*?)<\/figcaption>/is', $original_figure, $caption_match)) {
|
||||||
|
$caption = $caption_match[1]; // только содержимое
|
||||||
|
}
|
||||||
|
|
||||||
|
// Генерируем HTML изображения
|
||||||
|
$replacement = render_webp_picture_by_post($post->ID);
|
||||||
|
|
||||||
|
// Добавляем подпись, если есть
|
||||||
|
if (!empty($caption)) {
|
||||||
|
$replacement .= '<div class="image-caption">' . esc_html($caption) . '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Заменяем первое вхождение <figure>...</figure> на $replacement
|
||||||
|
$content = preg_replace('/<figure.*?>.*?<\/figure>/is', $replacement, $content, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
27
header.php
27
header.php
@@ -51,25 +51,14 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
|||||||
<body <?php body_class(); ?>>
|
<body <?php body_class(); ?>>
|
||||||
<?php wp_body_open(); ?>
|
<?php wp_body_open(); ?>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
|
<?if (function_exists('krutilka_placement')):?>
|
||||||
<?if (function_exists('ex_adv_get_banner')):
|
<div class="banner banner--header desktop">
|
||||||
|
<?=krutilka_placement( 'top-desktop' );?>
|
||||||
$mainbanner = ex_adv_get_banner(1);
|
</div>
|
||||||
if ($mainbanner !== ''):?>
|
<div class="banner banner--header mobile">
|
||||||
<div class="banner banner--header desktop">
|
<?=krutilka_placement( 'top-mob' );?>
|
||||||
<?=$mainbanner?>
|
</div>
|
||||||
</div>
|
<?endif?>
|
||||||
<?endif?>
|
|
||||||
|
|
||||||
<?$mobanner = ex_adv_get_banner(2);
|
|
||||||
if ($mobanner !== ''):?>
|
|
||||||
<div class="banner banner--header mobile">
|
|
||||||
<?=$mobanner?>
|
|
||||||
</div>
|
|
||||||
<?endif?>
|
|
||||||
|
|
||||||
<?endif?>
|
|
||||||
|
|
||||||
<header class="header">
|
<header class="header">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="header__inner">
|
<div class="header__inner">
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ $advertisers = new WP_Query([
|
|||||||
<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/02/whatsapp-image-2024-02-29-at-18.52.25.jpeg" alt="" class="advert-item__contacts-avatar"></div>
|
<div class="advert-item__avatar-container"><img src="https://agroexpert.press/wp-content/uploads/2024/02/whatsapp-image-2024-02-29-at-18.52.25.jpeg" 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">Daniil Trofimov</p>
|
<p class="advert-item__contact-name subtitle-13">Elena Mishina</p>
|
||||||
<p class="advert-item__contact-position text-13">Advertisement Manager</p>
|
<p class="advert-item__contact-position text-13">Advertisement Manager</p>
|
||||||
<p class="advert-item__contact-phone subtitle-13">Tel.: <a href="tel:79265551264"> +7 (926) 555 12 64</a></p>
|
<p class="advert-item__contact-phone subtitle-13">Tel.: <a href="tel:79265551264"> +7 (926) 555 12 64</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>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<a href="https://forum.rusgrain.org?erid=2VSb5zKAzHv" target="_blank" style="display: block; width: 240px; height: 400px; text-decoration: none; margin: 0 auto;">
|
<a href="https://forum.rusgrain.org?erid=2VSb5zKAzHv" target="_blank" style="display: block; width: 240px; height: 400px; text-decoration: none; margin: 0 auto;">
|
||||||
<div id="banner" class="banner-left" style="position: relative; width: 100%; height: 100%; background: url('https://agroexpert.press/wp-content/uploads/2025/03/forum_4-marta-2025-goda_480h800.jpg') no-repeat center/cover;">
|
<div id="banner" class="banner-left" style="position: relative; width: 100%; height: 100%; background: url('https://agroexpert.press/wp-content/uploads/2025/03/forum_4_-2025_480h800-01.jpg') no-repeat center/cover;">
|
||||||
<div id="countdown" style="position: absolute; bottom: 24px; right: 0px; font-family: Impact, Charcoal, sans-serif; font-size: 15px; text-transform: uppercase; background-color: green; color: white; padding: 6px 15px 6px 19px; border-bottom: 2px solid white;">
|
<div id="countdown" style="position: absolute; bottom: 24px; right: 0px; font-family: Impact, Charcoal, sans-serif; font-size: 15px; text-transform: uppercase; background-color: green; color: white; padding: 6px 15px 6px 19px; border-bottom: 2px solid white;">
|
||||||
Осталось 00 дней
|
Осталось 00 дней
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ if ($pinned_post):
|
|||||||
|
|
||||||
|
|
||||||
<a href="<?php echo get_permalink($pinned_post->ID); ?>" class="article-item__image-container">
|
<a href="<?php echo get_permalink($pinned_post->ID); ?>" class="article-item__image-container">
|
||||||
<?=show_post_image( $pinned_post->ID ); ?>
|
<?=render_webp_picture_by_post( $pinned_post->ID ); ?>
|
||||||
<div class="tag article-item__tag"><?=esc_html(get_category_name($pinned_post));?></div>
|
<div class="tag article-item__tag"><?=esc_html(get_category_name($pinned_post));?></div>
|
||||||
</a>
|
</a>
|
||||||
<div class="article-item__text">
|
<div class="article-item__text">
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ if ($pinned_post) :
|
|||||||
|
|
||||||
<a href="<?php echo get_permalink($pinned_post->ID); ?>" class="hero-banner">
|
<a href="<?php echo get_permalink($pinned_post->ID); ?>" class="hero-banner">
|
||||||
<div class="hero-banner__bg">
|
<div class="hero-banner__bg">
|
||||||
<?= show_post_image($pinned_post->ID); ?>
|
<?=render_webp_picture_by_post( $pinned_post->ID );?>
|
||||||
</div>
|
</div>
|
||||||
<p class="hero-banner__main">Главное</p>
|
<p class="hero-banner__main">Главное</p>
|
||||||
<div class="hero-banner__content">
|
<div class="hero-banner__content">
|
||||||
|
|||||||
@@ -9,24 +9,14 @@ if ($query->have_posts()) {
|
|||||||
$query->the_post();
|
$query->the_post();
|
||||||
get_template_part('content', 'post', ['full_width' => $post_count === 1 && $large_first_image]);
|
get_template_part('content', 'post', ['full_width' => $post_count === 1 && $large_first_image]);
|
||||||
if ($post_count === ($large_first_image ? 5 : 4)) : ?>
|
if ($post_count === ($large_first_image ? 5 : 4)) : ?>
|
||||||
<?if (function_exists('ex_adv_get_banner')):
|
<?if (function_exists('krutilka_placement')):?>
|
||||||
|
<div class="banner-middle desktop">
|
||||||
$middle_desk = ex_adv_get_banner(13);
|
<?=krutilka_placement( 'middle-desktop' );?>
|
||||||
if ($middle_desk !== ''):?>
|
</div>
|
||||||
<div class="banner-middle desktop">
|
<div class="banner-middle mobile">
|
||||||
<?=$middle_desk?>
|
<?=krutilka_placement( 'middle-mobile' );?>
|
||||||
</div>
|
</div>
|
||||||
<?endif?>
|
<?endif?>
|
||||||
|
|
||||||
<?$middle_mob = ex_adv_get_banner(14);
|
|
||||||
if ($middle_mob !== ''):?>
|
|
||||||
<div class="banner-middle mobile">
|
|
||||||
<?=$middle_mob?>
|
|
||||||
</div>
|
|
||||||
<?endif?>
|
|
||||||
|
|
||||||
<?endif?>
|
|
||||||
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,62 +23,25 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<?if (function_exists('krutilka_placement')):?>
|
||||||
<?if (function_exists('ex_adv_get_banner')):
|
<div class="banner-left desktop">
|
||||||
|
<?=krutilka_placement( 'left-desktop-1' );?>
|
||||||
$left_desk_1 = ex_adv_get_banner(3);
|
</div>
|
||||||
if ($left_desk_1 !== ''):?>
|
<div class="banner-left desktop">
|
||||||
<div class="banner-left desktop">
|
<?=krutilka_placement( 'left-desktop-2' );?>
|
||||||
<?=$left_desk_1?>
|
</div>
|
||||||
</div>
|
<div class="banner-left desktop">
|
||||||
<?endif?>
|
<?=krutilka_placement( 'left-desktop-3' );?>
|
||||||
|
</div>
|
||||||
<?$left_desk_2 = ex_adv_get_banner(4);
|
<div class="mobile" style="margin-top: 12px;">
|
||||||
if ($left_desk_2 !== ''):?>
|
<center><?=krutilka_placement( 'mobile-1' );?></center>
|
||||||
<div class="banner-left desktop">
|
</div>
|
||||||
<?=$left_desk_2?>
|
<div class="mobile" style="margin-top: 12px;">
|
||||||
</div>
|
<center><?=krutilka_placement( 'mobile-2' );?></center>
|
||||||
<?endif?>
|
</div>
|
||||||
|
<div class="mobile" style="margin-top: 12px;">
|
||||||
<?$left_desk_3 = ex_adv_get_banner(5);
|
<center><?=krutilka_placement( 'mobile-3' );?></center>
|
||||||
if ($left_desk_3 !== ''):?>
|
</div>
|
||||||
<div class="banner-left desktop">
|
|
||||||
<?=$left_desk_3?>
|
|
||||||
</div>
|
|
||||||
<?endif?>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?$left_mob_1 = ex_adv_get_banner(6);
|
|
||||||
if ( $left_mob_1 !== ''):?>
|
|
||||||
<div class="mobile" style="margin-top: 12px;">
|
|
||||||
<center>
|
|
||||||
<?=$left_mob_1?>
|
|
||||||
</center>
|
|
||||||
</div>
|
|
||||||
<?endif?>
|
|
||||||
|
|
||||||
<?$left_mob_2 = ex_adv_get_banner(7);
|
|
||||||
if ( $left_mob_2 !== ''):?>
|
|
||||||
<div class="mobile" style="margin-top: 12px;">
|
|
||||||
<center>
|
|
||||||
<?=$left_mob_2?>
|
|
||||||
</center>
|
|
||||||
</div>
|
|
||||||
<?endif?>
|
|
||||||
|
|
||||||
<?$left_mob_3 = ex_adv_get_banner(8);
|
|
||||||
if ( $left_mob_3 !== ''):?>
|
|
||||||
<div class="mobile" style="margin-top: 12px;">
|
|
||||||
<center>
|
|
||||||
<?=$left_mob_3?>
|
|
||||||
</center>
|
|
||||||
</div>
|
|
||||||
<?endif?>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<?endif?>
|
<?endif?>
|
||||||
|
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
@@ -22,37 +22,17 @@
|
|||||||
|
|
||||||
<?php get_template_part('partials/latest-legislation-posts'); ?>
|
<?php get_template_part('partials/latest-legislation-posts'); ?>
|
||||||
|
|
||||||
<?if (function_exists('ex_adv_get_banner')):
|
<?if (function_exists('krutilka_placement')):?>
|
||||||
|
<div class="banner-left desktop">
|
||||||
$right_desk_1 = ex_adv_get_banner(9);
|
<?=krutilka_placement( 'right-desk-1' );?>
|
||||||
if ($right_desk_1 !== ''):?>
|
</div>
|
||||||
<div class="banner-left desktop">
|
<div class="banner-left desktop">
|
||||||
<?=$right_desk_1?>
|
<?=krutilka_placement( 'right-desk-2' );?>
|
||||||
</div>
|
</div>
|
||||||
<?endif?>
|
<div class="banner-left mobile">
|
||||||
|
<?=krutilka_placement( 'mobile-4' );?>
|
||||||
<?$right_mob_1 = ex_adv_get_banner(11);
|
</div>
|
||||||
if ($right_mob_1 !== ''):?>
|
<?endif?>
|
||||||
<div class="banner-left mobile">
|
|
||||||
<?=$right_mob_1?>
|
|
||||||
</div>
|
|
||||||
<?endif?>
|
|
||||||
|
|
||||||
<?$right_desk_2 = ex_adv_get_banner(10);
|
|
||||||
if ($right_desk_2 !== ''):?>
|
|
||||||
<div class="banner-left desktop">
|
|
||||||
<?=$right_desk_2?>
|
|
||||||
</div>
|
|
||||||
<?endif?>
|
|
||||||
|
|
||||||
<?$right_mob_2 = ex_adv_get_banner(12);
|
|
||||||
if ($right_mob_2 !== ''):?>
|
|
||||||
<div class="banner-left mobile">
|
|
||||||
<?=$right_mob_2?>
|
|
||||||
</div>
|
|
||||||
<?endif?>
|
|
||||||
|
|
||||||
|
|
||||||
<?endif?>
|
<?php //get_template_part('partials/banner-counter'); ?>
|
||||||
|
|
||||||
<?php get_template_part('partials/banner-counter'); ?>
|
|
||||||
|
|||||||
@@ -41,7 +41,11 @@
|
|||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<div class="article-single__content">
|
<div class="article-single__content">
|
||||||
<?php the_content(); ?>
|
<?php
|
||||||
|
//$content = get_the_content();
|
||||||
|
$content = apply_filters('the_content', get_the_content());
|
||||||
|
echo replace_first_figure_in_content($content);
|
||||||
|
//the_content(); ?>
|
||||||
<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="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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user