Compare commits

...

10 Commits

Author SHA1 Message Date
8e6519e4f1 new logic banners 2025-09-03 00:00:47 +03:00
c64a070f59 new version codes 2025-08-08 10:56:18 +03:00
1746b28478 new privace documents 2025-07-04 23:11:22 +03:00
e3976a71fb new rutube url 2025-07-01 13:53:21 +03:00
a9e77639cd up tags 2025-06-19 20:23:57 +03:00
f458d9ec7c add page cookkie 2025-06-05 23:49:26 +03:00
b6fdef315f correct cookie footer 2025-06-04 11:21:09 +03:00
b1697d2b5a add cookies 2025-06-04 01:32:16 +03:00
14fbcc73de correct widjet pets 2025-05-09 11:09:48 +03:00
655a492022 add widget pets 2025-04-22 00:54:04 +03:00
19 changed files with 201 additions and 47 deletions

View File

@@ -52,7 +52,7 @@
<ul class="header-social-pets">
<li>
<a href="https://rutube.ru/u/Pets/" title="Rutube ПИТОМЦЫ" target="_blank">
<a href="https://rutube.ru/u/pitomcy" title="Rutube ПИТОМЦЫ" target="_blank">
<span class="socs soc-rutube-white"></span>
</a>
</li>
@@ -75,14 +75,6 @@
</li>
<li>
<a href="https://ok.ru/pitomcy.vetandlife" title="Одноклассники" target="_blank">
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="20" cy="20" r="19.5" stroke="#7A7A7A"/>
<path fill="#7A7A7A" d="M20.2,11c-2.6,0-4.7,2.1-4.7,4.7s2.1,4.7,4.7,4.7s4.7-2.1,4.7-4.7l0,0C24.8,13.1,22.8,11,20.2,11z M20.2,17.6 c-1.1,0-1.9-0.9-1.9-1.9c0-1.1,0.9-1.9,1.9-1.9s1.9,0.9,1.9,1.9l0,0C22.1,16.7,21.3,17.6,20.2,17.6L20.2,17.6z M21.8,24 c1.1-0.2,2.1-0.7,3-1.3c0.6-0.4,0.6-1.2,0.2-1.8s-1.2-0.6-1.8-0.2l0,0c-0.9,0.6-2,0.9-3.2,0.9c-1.1,0-2.2-0.3-3.2-0.9 c-0.6-0.4-1.4-0.3-1.8,0.2c-0.4,0.6-0.3,1.4,0.2,1.8l0,0c0.9,0.7,2,1.1,3.1,1.3l-2.7,2.8c-0.5,0.5-0.5,1.3,0,1.8 c0.5,0.5,1.3,0.5,1.8,0c0,0,0,0,0-0.1l2.7-2.5l2.7,2.7c0.5,0.5,1.3,0.4,1.8-0.1s0.5-1.2,0-1.7L21.8,24z"/>
</svg></a>
</li>
<li>
<a href="https://dzen.ru/pitomcy_vetandlife?favid=254162793" title="Дзен" target="_blank">
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">

View File

@@ -43,7 +43,7 @@
<a href="<?=get_site_url()?>?s"><li class="btn_search"></li></a>
<a href="<?=get_site_url()?>/rss/news.xml"><li class="btn_rss"></li></a>
<li class="toggle-nav" id="toggle-nav"></li>
<a href="<?=get_site_url().vij_lang('btn_lan_link', LANG_VERSION)?>"><li class="btn_lan"><nobr><?=vij_lang('btn_lan', LANG_VERSION)?></nobr></li></a>
<!--<a href="<?=get_site_url().vij_lang('btn_lan_link', LANG_VERSION)?>"><li class="btn_lan"><nobr><?=vij_lang('btn_lan', LANG_VERSION)?></nobr></li></a>-->
</ul>
<!-- Global site tag (gtag.js) - Google Analytics -->

View File

@@ -13,6 +13,9 @@ $ihash = add_hash_frm();?>
<button class="re_button" type="submit" name="re_num" value="<?=$ihash['num1'] ?>"><?= $ihash['num1'] ?></button>
<button class="re_button" type="submit" name="re_num" value="<?= $ihash['num2'] ?>"><?= $ihash['num2'] ?></button>
</form>
<div class="politics-izdanie">Нажимая на кнопку, Вы соглашаетесь на обработку персональных данных в соответствии с
<a href="https://vetandlife.ru/politika-v-otnoshenii-obrabotki-i-zashhity-personalnyh-dannyh-ooo-da-vinchi-media/" target="_blank">«Политикой конфиденциальности»</a></div>
</div>
</div>
</div>

58
blocks/pets.php Normal file
View File

@@ -0,0 +1,58 @@
<?php
// Задаем ID нужной категории (родительской)
$parent_cat_id = 14; // замените на нужный ID рубрики
// Получим 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="pets-widget<?if ($args['subclass'] !== '') echo ' '.$args['subclass'];?>">
<div class="pets-widget-maintitle"><a href="/pets">Питомцы</a></div>
<a href="<?php the_permalink(); ?>">
<?php if ( has_post_thumbnail() ) : ?>
<div>
<?php the_post_thumbnail('medium'); ?>
</div>
<?php endif; ?>
<h3 class="pets-widget-title"><?php the_title(); ?></h3>
</a>
</div>
<?php
wp_reset_postdata();
}
?>

View File

@@ -3,6 +3,7 @@
<a href="https://vk.com/vizhuvizh" target="_blank"><span class="socs soc-vk"></span></a>
<a href="https://t.me/ViZHuvizh" target="_blank"><span class="socs soc-tg"></span></a>
<a href="https://www.youtube.com/c/ВетеринарияиЖизнь" target="_blank"><span class="socs soc-rutube"></span></a>
<a href="https://www.youtube.com/c/ВетеринарияиЖизнь" target="_blank"><span class="socs soc-dzen"></span></a>
<!-- <div class="btn soc_vk"></div>
<div class="soc_btn soc_fb"></div>

View File

@@ -23,7 +23,9 @@ get_header();?>
<h1 class="my-4"><?single_cat_title()?></h1>
<div class="numbers-anons">
Федеральное отраслевое издание «Ветеринария и жизнь» это информационный портал с ежедневным обновлением ленты новостей и ежемесячная полноцветная газета на 16 полос тиражом 5 тысяч экземпляров, распространяющаяся по всей России. Мы рассказываем об актуальных событиях в области ветеринарии, животноводства, птицеводства, рыбохозяйственного комплекса, рынков сырья и продовольствия. Публикуем аналитические материалы с комментариями ведущих российских и мировых экспертов, ученых научно-производственных институтов Россельхознадзора, руководителей федеральных ведомств и отраслевых ассоциаций.
<p>Федеральное отраслевое издание «Ветеринария и жизнь» выходит с 2017 года и является крупнейшим периодическим печатным изданием в сфере сельского хозяйства и ветеринарии. К скачиванию доступен архив за все годы существования издания.<br><br>
Номера газеты выкладываются в общий доступ через месяц после выхода.<br><br>
Заказать свежий номер можно на Wildberries по <u><a href="https://www.wildberries.ru/catalog/482667738/detail.aspx?targetUrl=EX" target="_blank">ссылке</a></u></p>
</div>
<?php

6
cookie-consent.php Normal file
View File

@@ -0,0 +1,6 @@
<div id="cookie-consent-banner" class="cookie-consent" style="display: none;">
<div class="cookie-consent-content">
<p>Мы используем файлы cookie для улучшения работы сайта. Продолжая использование сайта, вы соглашаетесь с <a style="color: white; text-decoration: underline;" href="https://vetandlife.ru/cookies/" target="_blank">условиями</a>.</p>
<button id="cookie-consent-accept" class="cookie-consent-button">Принять</button>
</div>
</div>

View File

@@ -31,7 +31,7 @@
<?php //include VIJ_CACHE.'events.html';?>
<div class="right-info">
<a href="https://rutube.ru/u/Pets/" target="_blank">
<a href="https://rutube.ru/u/pitomcy" target="_blank">
<img src="https://vetandlife.ru/wp-content/uploads/2024/08/pets_rutube.jpg" width="240" height="200" />
</a>
</div>
@@ -249,9 +249,23 @@ window.yaContextCb.push(()=>{
<div class="socials-footer-pets">
<a href="https://rutube.ru/u/Pets/" target="_blank"><span class="socs soc-rutube"></span></a>
<a href="https://rutube.ru/u/pitomcy" target="_blank"><span class="socs soc-rutube"></span></a>
<a href="https://vk.com/pitomcy_vetandlife" target="_blank"><span class="socs soc-vk"></span></a>
<a href="https://t.me/pitomcy_vetandlife" target="_blank"><span class="socs soc-tg"></span></a>
<a href="https://dzen.ru/pitomcy_vetandlife?favid=254162793" target="_blank">
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="20" cy="20" r="19.5" stroke="#3B83B5"/>
<g id="_Слой_1-2">
<path fill="#3B83B5" d="M20.2,11.8c0,3.3,0.3,5.2,1.5,6.5s3.1,1.5,6.5,1.5C28.1,15.4,24.6,11.9,20.2,11.8z"/>
<path fill="#3B83B5" d="M18.2,18.2c1.2-1.3,1.5-3.1,1.5-6.5c-4.4,0.1-7.9,3.6-8,8C15.1,19.8,17,19.5,18.2,18.2z"/>
<path fill="#3B83B5" d="M11.8,20.2c0.1,4.4,3.6,7.9,8,8c0-3.3-0.3-5.2-1.5-6.5S15.1,20.3,11.8,20.2z"/>
<path fill="#3B83B5" d="M28.2,20.2c-3.3,0-5.2,0.3-6.5,1.5s-1.5,3.1-1.5,6.5C24.6,28.1,28.1,24.6,28.2,20.2L28.2,20.2z"/>
</g>
<path fill="#3B83B5" d="M20,1c10.5,0,19,8.5,19,19s-8.5,19-19,19S1,30.5,1,20S9.5,1,20,1 M20,0C9,0,0,9,0,20s9,20,20,20s20-9,20-20 S31,0,20,0z"/>
</svg>
</a>
</div>
</div>
@@ -307,7 +321,9 @@ document.write('<img src="'+pr+'?uid=18820&ref='+r+'&rd='+rd+'" width="88" heigh
</div>
<?php if (!isset($_COOKIE['cookie_consent_accepted'])) {
get_template_part('cookie-consent');
}?>
</footer>
<?php get_template_part( 'partials/formhash' );?>

View File

@@ -22,8 +22,8 @@
?>
<?php // get_template_part( '/blocks/citats');
get_blocks_gen( 'citats' );?>
get_template_part( '/blocks/pets');
//get_blocks_gen( 'citats' );?>
<?php //include VIJ_CACHE.'opinion.html';?>
<?php //get_template_part( '/blocks/citata', null, ['subclass' => '']);?>
<?php //get_template_part( '/blocks/events');?>
@@ -58,11 +58,24 @@ window.yaContextCb.push(()=>{
<a href="https://vk.com/vizhuvizh" target="_blank"><span class="socs soc-vk"></span></a>
<a href="https://t.me/ViZHuvizh" target="_blank"><span class="socs soc-tg"></span></a>
<a href="https://rutube.ru/channel/42943284/" target="_blank"><span class="socs soc-rutube"></span></a>
<a href="https://dzen.ru/vetandlife" target="_blank"><span class="socs soc-dzen"></span></a>
</div>
<?php include get_template_directory().'/blocks/archive.php';?>
<?php //include VIJ_CACHE.'archive.html'?>
<?if (function_exists('ex_adv_get_banner')):
$adv_left = ex_adv_get_banner( 2 );
if ($adv_left !== ''):?>
<div class="right-info">
<?=$adv_left?>
</div>
<?endif?>
<?endif?>
<?php get_template_part('partials/formsubscript'); ?>
@@ -70,15 +83,7 @@ window.yaContextCb.push(()=>{
<?if (function_exists('ex_adv_get_banner')):
$adv_left_1 = ex_adv_get_banner( 2 );
if ($adv_left_1 !== ''):?>
<div class="right-info">
<?=$adv_left_1?>
</div>
<?endif?>
<?$adv_left_2 = ex_adv_get_banner( 4 );
$adv_left_2 = ex_adv_get_banner( 4 );
if ($adv_left_2 !== ''):?>
<div class="right-info">
<?=$adv_left_2?>
@@ -270,7 +275,7 @@ window.yaContextCb.push(()=>{
<ul id="svid">
<li><a href="https://vetandlife.ru/rss/news.xml" target="_blank">RSS</a></li>
<li><a href="https://vetandlife.ru/wp-content/uploads/2021/11/vij-roskomnadzor.pdf" target="_blank"><?=vij_lang('svid_smi', LANG_VERSION);?></a></li>
<li><a href="https://vetandlife.ru/wp-content/uploads/2021/10/privacy.pdf" target="_blank"><?=vij_lang('conf_politic', LANG_VERSION);?></a></li>
<li><a href="https://vetandlife.ru/politika-v-otnoshenii-obrabotki-i-zashhity-personalnyh-dannyh-ooo-da-vinchi-media/" target="_blank">Политика в отношении обработки и защиты персональных данных</a></li>
</ul>
</div>
@@ -312,7 +317,9 @@ document.write('<img src="'+pr+'?uid=18820&ref='+r+'&rd='+rd+'" width="88" heigh
</div>
<?php if (!isset($_COOKIE['cookie_consent_accepted'])) {
get_template_part('cookie-consent');
}?>
</footer>
<?php get_template_part( 'partials/formhash' );?>

View File

@@ -44,14 +44,16 @@ ini_set('display_errors','off');
use PHPMailer\PHPMailer\PHPMailer;
require_once 'vite.config.php';
//add jquery
function theme_enqueue_scripts() {
wp_enqueue_script('jquery');
}
add_action('wp_enqueue_scripts', 'theme_enqueue_scripts', 1);
require_once 'vite.config.php';
//setlocale(LC_ALL, 'ru_RU', 'ru_RU.UTF-8', 'ru', 'russian');
@@ -105,6 +107,7 @@ require get_template_directory().'/src/calend-block.php';
require get_template_directory().'/src/calendar.php';
require get_template_directory().'/src/perevod.php';
require get_template_directory().'/lang.php'; // функции перевода
require get_template_directory().'/src/number-pdf.php'; // загрузка PDF номера
//require get_template_directory().'/blocks/card_post_id.php';
add_post_type_support('post', 'page-attributes');
@@ -123,7 +126,7 @@ function vij_send_smtp_email( PHPMailer $phpmailer ) {
$phpmailer->SMTPSecure = 'ssl';
$phpmailer->From = 'info@vetandlife.ru';
$phpmailer->FromName = 'Ветеринария и жизнь';
}*/
}
function vij_send_smtp_email( PHPMailer $phpmailer ) {
$phpmailer->isSMTP();
@@ -138,7 +141,25 @@ function vij_send_smtp_email( PHPMailer $phpmailer ) {
}
add_action( 'phpmailer_init', 'vij_send_smtp_email' );
//add_action( 'phpmailer_init', 'vij_send_smtp_email' );*/
function agroxpert_send_smtp_email( $phpmailer ) {
$phpmailer->isSMTP();
$phpmailer->Host = 'mail.vetandlife.ru';
$phpmailer->SMTPAuth = true;
$phpmailer->Port = 465;
$phpmailer->Username = 'ak@mail.agroexpert.press';
$phpmailer->Password = 'zhjk-ip-899-Jlie-Uisje3';
$phpmailer->SMTPSecure = 'ssl';
$phpmailer->From = 'ak@mail.agroexpert.press';
$phpmailer->FromName = 'Андрей Кувшинов';
}
add_action( 'phpmailer_init', 'agroxpert_send_smtp_email' );
db_config(DB_NAME, 'mysql:host='.DB_HOST.';dbname='.DB_NAME, DB_USER, DB_PASSWORD);
@@ -1119,4 +1140,36 @@ function restrict_author_publish_posts( $data ) {
}
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;
}
// Ищем первое <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;
}

View File

@@ -8,6 +8,7 @@
<meta name="zen-verification" content="9Ui9YzVJgKUB7bIgRNnAZqdHCNI8v9REm3TDpW0kciEicYyuD640moNznBDbFqcT" />
<title><?php wp_title('|', true, 'right');?><?=get_bloginfo('name')?></title>
<meta name="mailru-verification" content="4ede4cc0194a15dc" />
<meta name="google-site-verification" content="FB27Sl6c9EbSGRQfjtWB8jXItrl3XKwS_zr5q_T4Jz0" />
<meta property="og:title" content="<?php wp_title('|', true, 'right');?><?=get_bloginfo('name')?>" />
<link rel="apple-touch-icon" sizes="57x57" href="/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/apple-icon-60x60.png">

View File

@@ -1,25 +1,33 @@
<?php
function number_info($title){
function number_info($title, $post_id = 0){
$res = [];
$items = explode(' ', $title);
$number = substr($items[2], 1, strlen($items[2]) - 2);
//echo $number;
$res['year'] = $items[4];
$res['number'] = $number;
$pdf_url = get_post_meta($post_id, '_pdf_file', true);
if ($pdf_url) {
$res['guid'] = esc_url($pdf_url);
return $res;
}
$number = substr($items[2], 1, strlen($items[2]) - 2);
$name = 'vizh_'.$number.'_'.ru2enmonths($items[3]).'_'.$items[4];
//echo '<p>'.$name.'</p>';
//echo '<p>'.$name.'</p>';
$findpdf = db_get("SELECT * FROM `wp_posts` WHERE `post_name` = '$name' ORDER BY `post_modified` DESC LIMIT 1");
//echo "SELECT * FROM `wp_posts` WHERE `post_name` = '$name' ORDER BY `post_modified` DESC LIMIT 1";
if (isset($findpdf['guid'])){
$res['guid'] = $findpdf['guid'];
$res['year'] = $items[4];
$res['number'] = $number;
}
return $res;
}

View File

@@ -98,7 +98,7 @@ $nn = 0;?>
<?get_template_part( '/blocks/opinion', null, ['subclass' => 'mob-lite']);?>
<?get_template_part( '/blocks/citats', null, ['subclass' => 'mob-lite']);?>
<?get_template_part( '/blocks/pets', null, ['subclass' => 'mob-lite']);?>

View File

@@ -2,6 +2,8 @@
function vij_lang($name, $lan){
//vij_logo.svg
static $lang_ru = [
'link_version' => '/',
@@ -16,7 +18,7 @@ function vij_lang($name, $lan){
'alt_logo' => 'Ветеринария и жизнь. Информационный портал и газета',
'conf_politic' => 'Политика конфиденциальности',
'copyright' => 'Ветеринария и жизнь',
'subscript_btn' => 'Газета ВиЖ. Оформить подписку',
'subscript_btn' => 'Газета ВиЖ. Купить',
'svid_smi' => 'Свидетельство о регистрации СМИ',
'copyright_text' => 'При перепечатке и использовании информации с сайта «Ветеринария и жизнь» активная ссылка на использованный материал обязательна. При использовании материалов в печатных СМИ указывать источник — «Ветеринария и жизнь»',
'email_btn' => 'Подписаться',

View File

@@ -15,5 +15,7 @@ $ihash = add_hash_frm();?>
<button class="re_button" type="submit" name="re_num" value="<?=$ihash['num1'] ?>"><?= $ihash['num1'] ?></button>
<button class="re_button" type="submit" name="re_num" value="<?= $ihash['num2'] ?>"><?= $ihash['num2'] ?></button>
</form>
<div class="politics-izdanie">Нажимая на кнопку, Вы соглашаетесь на обработку персональных данных в соответствии с
<a href="https://vetandlife.ru/politika-v-otnoshenii-obrabotki-i-zashhity-personalnyh-dannyh-ooo-da-vinchi-media/" target="_blank">«Политикой конфиденциальности»</a></div>
</div>
</div>

View File

@@ -2,4 +2,5 @@
<a href="https://vk.com/vizhuvizh" target="_blank"><span class="socs soc-vk"></span></a>
<a href="https://t.me/ViZHuvizh" target="_blank"><span class="socs soc-tg"></span></a>
<a href="https://rutube.ru/channel/42943284/" target="_blank"><span class="socs soc-rutube"></span></a>
<a href="https://dzen.ru/vetandlife" target="_blank"><span class="socs soc-dzen"></span></a>
</div>

View File

@@ -31,7 +31,7 @@ get_header();?>
<li><?=mb_substr(get_the_title(), 0, 50);?>...</li>
</ul>
<?$curr_number = number_info(get_the_title())?>
<?$curr_number = number_info(get_the_title(), $post_id);?>
<h1 class="post-h1">Федеральное отраслевое издание «Ветеринария и жизнь»</h1>

View File

@@ -111,6 +111,10 @@ if ( $pets_cat ){
<?endif?>
</div>
<div id="tags" style="margin-top: 22px;">
<?php the_tags();?>
</div>
<div class="post_panel_info">
<div class="post_panel_info_sub">
<span class="post_link_category"><a href="<?=$category_link?>"><?=$category_name;?></a></span>, <nobr><?php the_time('j F Y, G:i');?></nobr>
@@ -148,9 +152,7 @@ if ( $pets_cat ){
<?php include get_template_directory().'/blocks/yets.php';?>
<div id="tags">
<?php the_tags();?>
</div>
</div>

View File

@@ -33,8 +33,8 @@ add_action( 'wp_enqueue_scripts', function () {
$style_ver = filemtime(get_template_directory() . $fstyle);
$script_ver = filemtime(get_template_directory() . $fscript);
wp_enqueue_style('vij-style', get_template_directory_uri() . $fstyle, array(), $style_ver.'8');
wp_enqueue_script('vij-script', get_template_directory_uri() . $fscript, array(), $script_ver, 5);
wp_enqueue_style('vij-style', get_template_directory_uri() . $fstyle, array(), $style_ver.'17');
wp_enqueue_script('vij-script', get_template_directory_uri() . $fscript, array(), $script_ver.'10', 5);
}
});