add spavochniki and rfo
This commit is contained in:
28
archive-spravochniki.php
Normal file
28
archive-spravochniki.php
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?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(); ?>
|
||||||
@@ -21,7 +21,7 @@ $partners = new WP_Query([
|
|||||||
$partners->the_post();
|
$partners->the_post();
|
||||||
?>
|
?>
|
||||||
<a href="<?= get_permalink(); ?>" class="partner-item">
|
<a href="<?= get_permalink(); ?>" class="partner-item">
|
||||||
<div>
|
<div class="partner-logo">
|
||||||
<?if ( has_post_thumbnail() ) {
|
<?if ( has_post_thumbnail() ) {
|
||||||
the_post_thumbnail( 'thumbnail' ); // Это выведет самую маленькую превьюшку
|
the_post_thumbnail( 'thumbnail' ); // Это выведет самую маленькую превьюшку
|
||||||
}?>
|
}?>
|
||||||
|
|||||||
97
footer-rfo.php
Normal file
97
footer-rfo.php
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
<?php if (!is_404() && !is_500()) : ?>
|
||||||
|
<? if (!is_page('search') && !is_search()) : ?>
|
||||||
|
<div class="content-right">
|
||||||
|
<?php get_sidebar('right'); ?>
|
||||||
|
</div>
|
||||||
|
<? endif; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<? endif; ?>
|
||||||
|
</main>
|
||||||
|
<footer itemscope itemtype="https://schema.org/WPFooter" class="footer">
|
||||||
|
<div class="footer-top">
|
||||||
|
<div class="container footer__conatiner">
|
||||||
|
<div class="footer-top__inner">
|
||||||
|
<?php $site_logo = get_field('site_logo', 'option'); ?>
|
||||||
|
<a href="<?php echo home_url(); ?>" class="logo footer__logo">
|
||||||
|
<img src="<?php echo esc_url($site_logo); ?>" alt="" />
|
||||||
|
</a>
|
||||||
|
<nav class="nav footer__nav">
|
||||||
|
<?php get_template_part('partials/menu-primary'); ?>
|
||||||
|
</nav>
|
||||||
|
<div class="footer-top__right">
|
||||||
|
<a href="#" class="to-top">
|
||||||
|
<span>Наверх</span>
|
||||||
|
<svg width="9" height="6" viewBox="0 0 9 6" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<rect x="3.69409" y="1.05029" width="1" height="5.22423" transform="rotate(45 3.69409 1.05029)" fill="black" />
|
||||||
|
<rect width="1" height="6" transform="matrix(-0.707107 0.707107 0.707107 0.707107 4.1333 0.525146)" fill="black" />
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="footer-bottom">
|
||||||
|
<div class="container">
|
||||||
|
<div class="footer-bottom__inner">
|
||||||
|
<?php $copyright = get_field('copyright', 'option'); ?>
|
||||||
|
<div class="footer-bottom__text desktop">
|
||||||
|
<?= sprintf('© %d %s', date('Y'), $copyright); ?>
|
||||||
|
</div>
|
||||||
|
<?php get_template_part('partials/menu-footer-bottom'); ?>
|
||||||
|
<div class="socials footer__socials">
|
||||||
|
<?php get_template_part('partials/menu-socials'); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="footer-bottom__text mobile">
|
||||||
|
<?= sprintf('© %d %s', date('Y'), $copyright); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="footer-bottom">
|
||||||
|
<div class="container">
|
||||||
|
<div class="footer-bottom__inner">
|
||||||
|
<div class="rating"><svg width="50" height="50" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<circle cx="25" cy="25" r="20" fill="green" />
|
||||||
|
<text x="50%" y="50%" text-anchor="middle" fill="white" font-size="15px" font-weight="bold" dy=".3em">16+</text>
|
||||||
|
</svg>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p>При перепечатке и использовании информации с сайта «Агроэксперт» активная ссылка на использованный материал обязательна. При использовании материалов в печатных СМИ указывать источник — «Агроэксперт».</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="counter-container"></div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-overlay" id="modal-thank" style="display: none">
|
||||||
|
<div class="modal modal-thank">
|
||||||
|
<div class="modal__close modal-thank__close">
|
||||||
|
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<rect y="16.9423" width="23.9584" height="1.4974" rx="0.748701" transform="rotate(-45 0 16.9423)" fill="black" />
|
||||||
|
<rect x="1.0625" width="23.9584" height="1.4974" rx="0.748701" transform="rotate(45 1.0625 0)" fill="black" />
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
<div class="modal-thank__title">Благодарим за интерес!</div>
|
||||||
|
<div class="modal-thank__text">
|
||||||
|
На Вашу почту отправлено письмо для <br />
|
||||||
|
подтверждения подписки
|
||||||
|
</div>
|
||||||
|
<div class="modal-thank__footer modal__close">Закрыть</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
</div>
|
||||||
|
<?php wp_footer(); ?>
|
||||||
|
|
||||||
|
<?php // get_template_part('partials/rtb-floor.php'); ?>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
@@ -80,6 +80,13 @@ ul.wp-block-list li{
|
|||||||
background: var(--secondary);
|
background: var(--secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.partner-logo IMG{
|
||||||
|
height: auto;
|
||||||
|
display: block;
|
||||||
|
width: 150px;
|
||||||
|
max-width: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@media (max-width: 1439px) {
|
@media (max-width: 1439px) {
|
||||||
.content {
|
.content {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
setlocale(LC_TIME, 'ru_RU.UTF-8');
|
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/spravochniki.php'; // Подключаем справочники
|
||||||
|
|
||||||
// Полностью отключить XML-RPC
|
// Полностью отключить XML-RPC
|
||||||
add_filter( 'xmlrpc_enabled', '__return_false' );
|
add_filter( 'xmlrpc_enabled', '__return_false' );
|
||||||
@@ -1277,7 +1278,7 @@ function replace_first_figure_in_content($content) {
|
|||||||
add_filter('get_terms', function($terms, $taxonomies, $args) {
|
add_filter('get_terms', function($terms, $taxonomies, $args) {
|
||||||
global $pagenow;
|
global $pagenow;
|
||||||
if (($pagenow === 'post.php' || $pagenow === 'post-new.php') && in_array('category', $taxonomies)) {
|
if (($pagenow === 'post.php' || $pagenow === 'post-new.php') && in_array('category', $taxonomies)) {
|
||||||
$exclude_ids = [7]; // ID рубрик, которые нужно скрыть
|
$exclude_ids = [7, 740, 741, 742, 743, 744, 745, 746, 762]; // ID рубрик, которые нужно скрыть
|
||||||
$terms = array_filter($terms, fn($term) => !in_array($term->term_id, $exclude_ids));
|
$terms = array_filter($terms, fn($term) => !in_array($term->term_id, $exclude_ids));
|
||||||
}
|
}
|
||||||
return $terms;
|
return $terms;
|
||||||
@@ -1285,7 +1286,7 @@ add_filter('get_terms', function($terms, $taxonomies, $args) {
|
|||||||
|
|
||||||
// Для REST API (панель справа в редакторе Gutenberg)
|
// Для REST API (панель справа в редакторе Gutenberg)
|
||||||
add_filter('rest_category_query', function($args, $request) {
|
add_filter('rest_category_query', function($args, $request) {
|
||||||
$args['exclude'] = [7]; // Те же ID, что и выше
|
$args['exclude'] = [7, 740, 741, 742, 743, 744, 745, 746, 762]; // Те же ID, что и выше
|
||||||
return $args;
|
return $args;
|
||||||
}, 10, 2);
|
}, 10, 2);
|
||||||
|
|
||||||
|
|||||||
163
header-rfo.php
Normal file
163
header-rfo.php
Normal file
@@ -0,0 +1,163 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html <?php language_attributes(); ?>>
|
||||||
|
|
||||||
|
<head itemscope itemtype="https://schema.org/WPHeader">
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<meta name="zen-verification" content="xdaKRGoPCQTgRYUKZ7tBq2pDm8JxN4zVv8KxInVPCyE11AQGYpdnVL5ocisUY6w7" />
|
||||||
|
<meta name="google-site-verification" content="wKVjdTPQrw11PE9o4Blxqv7qbdFmxarn8ez4fCJd_po" />
|
||||||
|
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
|
||||||
|
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
|
||||||
|
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
|
||||||
|
<link rel="manifest" href="/site.webmanifest">
|
||||||
|
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
|
||||||
|
<meta name="msapplication-TileColor" content="#da532c">
|
||||||
|
<meta name="theme-color" content="#ffffff">
|
||||||
|
<meta name="yandex-verification" content="209d13da5a697e41" />
|
||||||
|
<?php wp_head(); ?>
|
||||||
|
<!-- Yandex.Metrika counter -->
|
||||||
|
<script type="text/javascript" >
|
||||||
|
(function(m,e,t,r,i,k,a){m[i]=m[i]||function(){(m[i].a=m[i].a||[]).push(arguments)};
|
||||||
|
m[i].l=1*new Date();
|
||||||
|
for (var j = 0; j < document.scripts.length; j++) {if (document.scripts[j].src === r) { return; }}
|
||||||
|
k=e.createElement(t),a=e.getElementsByTagName(t)[0],k.async=1,k.src=r,a.parentNode.insertBefore(k,a)})
|
||||||
|
(window, document, "script", "https://mc.yandex.ru/metrika/tag.js", "ym");
|
||||||
|
|
||||||
|
ym(96621494, "init", {
|
||||||
|
clickmap:true,
|
||||||
|
trackLinks:true,
|
||||||
|
accurateTrackBounce:true
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<noscript><div><img src="https://mc.yandex.ru/watch/96621494" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
|
||||||
|
<!-- /Yandex.Metrika counter -->
|
||||||
|
<!-- Yandex.RTB -->
|
||||||
|
<script>window.yaContextCb=window.yaContextCb||[]</script>
|
||||||
|
<script src="https://yandex.ru/ads/system/context.js" async></script>
|
||||||
|
<!-- Google Tag Manager -->
|
||||||
|
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
|
||||||
|
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
|
||||||
|
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
|
||||||
|
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
|
||||||
|
})(window,document,'script','dataLayer','GTM-W6Z5FN8Z');</script>
|
||||||
|
<!-- End Google Tag Manager -->
|
||||||
|
<!-- Google Tag Manager (noscript) -->
|
||||||
|
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-W6Z5FN8Z"
|
||||||
|
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
||||||
|
<!-- End Google Tag Manager (noscript) -->
|
||||||
|
</head>
|
||||||
|
|
||||||
|
|
||||||
|
<body <?php body_class(); ?>>
|
||||||
|
<?php wp_body_open(); ?>
|
||||||
|
<div id="app">
|
||||||
|
<?if (function_exists('krutilka_placement')):?>
|
||||||
|
<div class="banner banner--header desktop">
|
||||||
|
<?=krutilka_placement( 'top-desktop' );?>
|
||||||
|
</div>
|
||||||
|
<div class="banner banner--header mobile">
|
||||||
|
<?=krutilka_placement( 'top-mob' );?>
|
||||||
|
</div>
|
||||||
|
<?endif?>
|
||||||
|
<header class="header">
|
||||||
|
<div class="container">
|
||||||
|
<div class="header__inner">
|
||||||
|
<?php $site_logo = get_field('site_logo', 'option');?>
|
||||||
|
<a href="<?php echo home_url(); ?>" class="logo header__logo">
|
||||||
|
<img src="<?php echo esc_url($site_logo); ?>" width="158" alt="" />
|
||||||
|
</a>
|
||||||
|
<nav class="nav header__nav">
|
||||||
|
<?php get_template_part('partials/menu-primary'); ?>
|
||||||
|
</nav>
|
||||||
|
<div class="lang-switch"><a href="<?php echo home_url();?>/en/">EN</a></div>
|
||||||
|
<div class="header__right">
|
||||||
|
<div class="header__actions">
|
||||||
|
<a href="/search/?orderby=post_date&order=desc">
|
||||||
|
<button class="header-action">
|
||||||
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<g clip-path="url(#clip0_464_1772)">
|
||||||
|
<path d="M14.9137 13.7179L12.0505 10.8632C12.9743 9.68632 13.4755 8.23298 13.4737 6.73684C13.4737 5.40442 13.0786 4.10192 12.3384 2.99405C11.5981 1.88619 10.5459 1.02271 9.31495 0.512814C8.08392 0.0029189 6.72937 -0.130493 5.42255 0.129449C4.11573 0.389392 2.91534 1.03101 1.97318 1.97318C1.03101 2.91534 0.389392 4.11573 0.129449 5.42255C-0.130493 6.72937 0.0029189 8.08392 0.512814 9.31495C1.02271 10.5459 1.88619 11.5981 2.99405 12.3384C4.10192 13.0786 5.40442 13.4737 6.73684 13.4737C8.23298 13.4755 9.68632 12.9743 10.8632 12.0505L13.7179 14.9137C13.7962 14.9926 13.8893 15.0552 13.9919 15.098C14.0946 15.1408 14.2046 15.1628 14.3158 15.1628C14.4269 15.1628 14.537 15.1408 14.6397 15.098C14.7422 15.0552 14.8354 14.9926 14.9137 14.9137C14.9926 14.8354 15.0552 14.7422 15.098 14.6397C15.1408 14.537 15.1628 14.4269 15.1628 14.3158C15.1628 14.2046 15.1408 14.0946 15.098 13.9919C15.0552 13.8893 14.9926 13.7962 14.9137 13.7179ZM1.68421 6.73684C1.68421 5.73753 1.98055 4.76066 2.53574 3.92975C3.09092 3.09886 3.88004 2.45124 4.80328 2.06883C5.72653 1.6864 6.74245 1.58634 7.72257 1.7813C8.70265 1.97625 9.60295 2.45747 10.3096 3.16409C11.0163 3.87072 11.4974 4.77101 11.6924 5.75112C11.8873 6.73124 11.7873 7.74716 11.4049 8.6704C11.0225 9.59368 10.3748 10.3827 9.54392 10.9379C8.71301 11.4931 7.73616 11.7895 6.73684 11.7895C5.3968 11.7895 4.11165 11.2572 3.16409 10.3096C2.21654 9.36202 1.68421 8.07688 1.68421 6.73684Z" fill="black" />
|
||||||
|
</g>
|
||||||
|
<defs>
|
||||||
|
<clipPath id="clip0_464_1772">
|
||||||
|
<rect width="16" height="16" fill="white" />
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</a>
|
||||||
|
<a href="/feed/">
|
||||||
|
<button class="header-action">
|
||||||
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<g clip-path="url(#clip0_464_1774)">
|
||||||
|
<path d="M0.000840634 1.02697C0.00606145 0.886771 0.0388899 0.748976 0.0974455 0.621481C0.156001 0.493985 0.239134 0.379293 0.342081 0.283974C0.445029 0.188656 0.565771 0.114583 0.69739 0.0659987C0.829008 0.017414 0.968918 -0.00472821 1.10911 0.000840634C3.58378 0.095774 7.26911 0.942707 10.3646 3.20511C13.5091 5.50484 16.0009 9.23818 16.0009 14.9342C16.0009 15.2171 15.8884 15.4884 15.6884 15.6884C15.4884 15.8884 15.2171 16.0009 14.9342 16.0009C14.6513 16.0009 14.3799 15.8884 14.1799 15.6884C13.9798 15.4884 13.8675 15.2171 13.8675 14.9342C13.8675 9.96351 11.7374 6.85204 9.10484 4.92884C6.42324 2.96938 3.17418 2.21631 1.02697 2.13418C0.886771 2.12895 0.748976 2.09613 0.621481 2.03757C0.493985 1.97902 0.379293 1.89588 0.283974 1.79293C0.188656 1.68998 0.114583 1.56925 0.0659987 1.43762C0.017414 1.30601 -0.00472821 1.16717 0.000840634 1.02697ZM0.00404041 7.39178C0.0242572 7.10977 0.155601 6.84734 0.369212 6.66213C0.582822 6.47692 0.861223 6.3841 1.14324 6.40404C2.54484 6.50324 4.61738 7.03338 6.36884 8.33044C8.16511 9.65951 9.60084 11.7865 9.60084 14.9342C9.60084 15.2171 9.48846 15.4884 9.28841 15.6884C9.08838 15.8884 8.81707 16.0009 8.53417 16.0009C8.25127 16.0009 7.97997 15.8884 7.77992 15.6884C7.57989 15.4884 7.46751 15.2171 7.46751 14.9342C7.46751 12.5363 6.41471 11.0185 5.09951 10.0446C3.74058 9.03871 2.07978 8.60884 0.991774 8.53204C0.851948 8.52204 0.715466 8.48456 0.59013 8.42178C0.464796 8.35899 0.353066 8.27212 0.261331 8.16611C0.169596 8.06011 0.0996551 7.93707 0.0555073 7.80402C0.0113594 7.67096 -0.00612986 7.53158 0.00404041 7.39178ZM0.000840634 14.9342C0.000840634 14.6513 0.113221 14.3799 0.313261 14.1799C0.513299 13.9798 0.78461 13.8675 1.06751 13.8675H1.07818C1.36107 13.8675 1.63238 13.9798 1.83242 14.1799C2.03246 14.3799 2.14484 14.6513 2.14484 14.9342C2.14484 15.2171 2.03246 15.4884 1.83242 15.6884C1.63238 15.8884 1.36107 16.0009 1.07818 16.0009H1.06751C0.78461 16.0009 0.513299 15.8884 0.313261 15.6884C0.113221 15.4884 0.000840634 15.2171 0.000840634 14.9342Z" fill="black" />
|
||||||
|
</g>
|
||||||
|
<defs>
|
||||||
|
<clipPath id="clip0_464_1774">
|
||||||
|
<rect width="16" height="16" fill="white" />
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<div class="socials header__socials">
|
||||||
|
<?php get_template_part('partials/menu-socials'); ?>
|
||||||
|
</div>
|
||||||
|
<div class="header__burger">
|
||||||
|
<img src="<?= get_asset('/images/burger.svg') ?>" alt="" />
|
||||||
|
<img src="<?= get_asset('/images/burger_close.svg') ?>" alt="" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="header-mobile">
|
||||||
|
<nav class="nav header-mobile__nav">
|
||||||
|
<?php get_template_part('partials/menu-primary'); ?>
|
||||||
|
</nav>
|
||||||
|
<div class="socials header-mobile__socials">
|
||||||
|
<?php get_template_part('partials/menu-socials'); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
<main class="main">
|
||||||
|
<?php if (function_exists('yoast_breadcrumb') && !is_front_page()) : ?>
|
||||||
|
<div class="breadcrumbs">
|
||||||
|
<div class="container">
|
||||||
|
<?php yoast_breadcrumb('<div class="breadcrumbs__list">', '</div>'); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (is_front_page()) : ?>
|
||||||
|
<div class="hero">
|
||||||
|
<div class="container hero__container">
|
||||||
|
<div class="hero__inner">
|
||||||
|
<?php get_template_part('partials/pinned-post'); ?>
|
||||||
|
<div class="most-read hero__most-read">
|
||||||
|
<div class="most-read__inner">
|
||||||
|
<p class="most-read__title subtitle-20">Главное сегодня</p>
|
||||||
|
<div class="most-read__links">
|
||||||
|
<?php get_template_part('partials/most-read-posts'); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="menu">
|
||||||
|
<div class="container">
|
||||||
|
<div class="menu__inner">
|
||||||
|
<?php get_template_part('partials/category-menu'); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if (!is_404() && !is_500()) : ?>
|
||||||
|
<div class="container">
|
||||||
|
<div class="content">
|
||||||
|
<? if (!is_page('search') && !is_search() && !is_404()) : ?>
|
||||||
|
<div class="content-left">
|
||||||
|
<?php get_sidebar('left'); ?>
|
||||||
|
</div>
|
||||||
|
<? endif; ?>
|
||||||
|
<? endif; ?>
|
||||||
90
inc/spravochniki.php
Normal file
90
inc/spravochniki.php
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
function agro_register_spravochniki_post_type() {
|
||||||
|
register_post_type('spravochniki', [
|
||||||
|
'labels' => [
|
||||||
|
'menu_name' => 'Справочники',
|
||||||
|
'name' => 'Статьи',
|
||||||
|
'singular_name' => 'Статья',
|
||||||
|
'add_new' => 'Добавить статью',
|
||||||
|
'add_new_item' => 'Добавить новую статью',
|
||||||
|
'edit_item' => 'Редактировать статью',
|
||||||
|
'new_item' => 'Новая статья',
|
||||||
|
'view_item' => 'Посмотреть статью',
|
||||||
|
'search_items' => 'Искать статью',
|
||||||
|
'not_found' => 'Не найдено',
|
||||||
|
'not_found_in_trash' => 'В корзине не найдено',
|
||||||
|
],
|
||||||
|
'public' => true,
|
||||||
|
'has_archive' => false,
|
||||||
|
'rewrite' => true, // переопределим вручную
|
||||||
|
'hierarchical' => false,
|
||||||
|
'supports' => ['title', 'editor', 'excerpt', 'thumbnail'],
|
||||||
|
'taxonomies' => ['spravochnik_category'], // прикрепим свою таксономию
|
||||||
|
'show_in_rest' => true, // поддержка Gutenberg
|
||||||
|
'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');
|
||||||
|
|
||||||
|
|
||||||
|
// Подзаголовок
|
||||||
|
function agro_allow_meta_boxes_in_gutenberg($use_block_editor, $post_type) {
|
||||||
|
if ($post_type === 'spravochniki') {
|
||||||
|
return true; // разрешаем Gutenberg
|
||||||
|
}
|
||||||
|
return $use_block_editor;
|
||||||
|
}
|
||||||
|
add_filter('use_block_editor_for_post_type', 'agro_allow_meta_boxes_in_gutenberg', 10, 2);
|
||||||
|
|
||||||
|
|
||||||
|
function agro_add_spravochnik_subtitle_meta_box() {
|
||||||
|
add_meta_box(
|
||||||
|
'agro_spravochnik_subtitle',
|
||||||
|
'Подзаголовок',
|
||||||
|
'agro_spravochnik_subtitle_callback',
|
||||||
|
'spravochniki',
|
||||||
|
'side',
|
||||||
|
'high' // <-- вот здесь!
|
||||||
|
);
|
||||||
|
}
|
||||||
|
add_action('add_meta_boxes', 'agro_add_spravochnik_subtitle_meta_box');
|
||||||
|
|
||||||
|
|
||||||
|
function agro_spravochnik_subtitle_callback($post) {
|
||||||
|
$subtitle = get_post_meta($post->ID, '_spravochnik_subtitle', true);
|
||||||
|
echo '<input type="text" name="spravochnik_subtitle" value="' . esc_attr($subtitle) . '" style="width:100%;" />';
|
||||||
|
}
|
||||||
|
|
||||||
|
function agro_save_spravochnik_subtitle($post_id) {
|
||||||
|
if (array_key_exists('spravochnik_subtitle', $_POST)) {
|
||||||
|
update_post_meta($post_id, '_spravochnik_subtitle', sanitize_text_field($_POST['spravochnik_subtitle']));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
add_action('save_post', 'agro_save_spravochnik_subtitle');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -30,7 +30,9 @@ if ( in_category('interviews') ) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?if (function_exists('krutilka_placement')):?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?if (function_exists('krutilka_placement')):?>
|
||||||
<div class="banner-left desktop">
|
<div class="banner-left desktop">
|
||||||
<?=krutilka_placement( 'left-desktop-1' );?>
|
<?=krutilka_placement( 'left-desktop-1' );?>
|
||||||
</div>
|
</div>
|
||||||
@@ -49,6 +51,4 @@ if ( in_category('interviews') ) {
|
|||||||
<div class="mobile" style="margin-top: 12px;">
|
<div class="mobile" style="margin-top: 12px;">
|
||||||
<center><?=krutilka_placement( 'mobile-3' );?></center>
|
<center><?=krutilka_placement( 'mobile-3' );?></center>
|
||||||
</div>
|
</div>
|
||||||
<?endif?>
|
<?endif?>
|
||||||
|
|
||||||
<?php endif; ?>
|
|
||||||
79
single-spravochniki.php
Normal file
79
single-spravochniki.php
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
<?php get_header(); ?>
|
||||||
|
|
||||||
|
<?php if (in_category('events')) : ?>
|
||||||
|
<?php get_template_part('single-events'); ?>
|
||||||
|
<? else : ?>
|
||||||
|
<div class="content-middle articles-wrapper">
|
||||||
|
<?php get_template_part('partials/rubrics-mobile'); ?>
|
||||||
|
|
||||||
|
<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>
|
||||||
|
<?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">
|
||||||
|
<?php
|
||||||
|
//$content = get_the_content();
|
||||||
|
$post_id = get_the_ID();
|
||||||
|
if ( $post_id == 26011 ) {
|
||||||
|
the_content();
|
||||||
|
} else {
|
||||||
|
$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>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php // get_template_part('partials/rtb-single'); ?>
|
||||||
|
|
||||||
|
<?php get_template_part('partials/featured-posts'); ?>
|
||||||
|
<?php if (!in_category('partners')) : ?>
|
||||||
|
<?php get_template_part('partials/related-posts'); ?>
|
||||||
|
<? else : ?>
|
||||||
|
<div class="section-title">
|
||||||
|
<h2 class="section-title__title subtitle-18">Еще по теме</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="suggestion-container">
|
||||||
|
<?
|
||||||
|
$args = [
|
||||||
|
'category_name' => 'partners',
|
||||||
|
'post_status' => 'publish',
|
||||||
|
'order' => 'ASC',
|
||||||
|
'posts_per_page' => 4
|
||||||
|
];
|
||||||
|
$posts = get_posts($args);
|
||||||
|
$counter = 0;
|
||||||
|
foreach ($posts as $post) : ?>
|
||||||
|
<div class="suggestion-item">
|
||||||
|
<a href="<?= the_permalink() ?>">
|
||||||
|
<h3 class="subtitle-16"> <?= the_title() ?></h3>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
<? endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<? endif; ?>
|
||||||
|
<a href="<?= home_url(); ?>" class="articles-preview__show-next desktop">На главную</a>
|
||||||
|
<div class="articles__spacer-container">
|
||||||
|
<div class="articles__spacer"></div>
|
||||||
|
<div class="articles__spacer"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<? endif; ?>
|
||||||
|
|
||||||
|
<?php get_footer(); ?>
|
||||||
28
taxonomy-spravochnik_cat.php
Normal file
28
taxonomy-spravochnik_cat.php
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?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(); ?>
|
||||||
Reference in New Issue
Block a user