diff --git a/category-vystavki-i-konferenitsii.php b/category-61.php similarity index 100% rename from category-vystavki-i-konferenitsii.php rename to category-61.php diff --git a/functions.php b/functions.php index 5a78cd3..8ad7bc1 100644 --- a/functions.php +++ b/functions.php @@ -50,18 +50,54 @@ function mob_block($template){ } +//свой шаблон для категории +add_filter('category_template', function (){ + + $category = get_queried_object(); + $parent_id = $category->category_parent; // ID родителя + + $template = array(); //массив для поиска шаблонов + + $templates[] = "category-{$category->slug}.php"; + $templates[] = "category-{$category->term_id}.php"; + + if ($parent_id > 0){ + + $parent = get_category($parent_id); + $templates[] = "category-{$parent->slug}.php"; + $templates[] = "category-{$parent->term_id}.php"; + + } + + $templates[] = 'category.php'; + + return locate_template($templates); + + +}); + + //свой шаблон для категории add_filter( 'single_template', function ( $single_template ) { - + + $category = (array) get_the_category(); - foreach( (array) get_the_category() as $cat ) { - - if ( file_exists(TEMPLATEPATH . "/single-{$cat->slug}.php") ) - return TEMPLATEPATH . "/single-{$cat->slug}.php"; - - } - - return $single_template; + foreach( $category as $cat ) { + + if ( file_exists(TEMPLATEPATH . "/single-{$cat->term_id}.php") ){ + return TEMPLATEPATH . "/single-{$cat->term_id}.php"; + } + + $parent_id = $cat->parent; // шаблон гл рубрики + + if ($parent_id > 0){ + $parent = get_category($parent_id); + if (file_exists(TEMPLATEPATH . "/single-{$parent->term_id}.php") ) + return TEMPLATEPATH . "/single-{$parent->term_id}.php"; + } + + } + return $single_template; }, PHP_INT_MAX, 2 ); diff --git a/header.php b/header.php index ed4db6c..7bfe1ef 100644 --- a/header.php +++ b/header.php @@ -4,7 +4,7 @@ <?php wp_title('|', true, 'right');?><?=get_bloginfo('name')?> - + diff --git a/single-vystavki-i-konferenitsii.php b/single-61.php similarity index 100% rename from single-vystavki-i-konferenitsii.php rename to single-61.php diff --git a/single.php b/single.php index 24a8c74..203e2ad 100644 --- a/single.php +++ b/single.php @@ -46,10 +46,12 @@
- -

Свежие отраслевые новости на нашем канале в Telegram

-

Добавьте «Ветеринарию и жизнь» в избранное в ЯНДЕКС.НОВОСТИ

+
+
+

Свежие отраслевые новости на нашем канале в Telegram

+

Добавьте «Ветеринарию и жизнь» в избранное в ЯНДЕКС.НОВОСТИ

+
diff --git a/style.css b/style.css index 9f57e9d..4c65a79 100644 --- a/style.css +++ b/style.css @@ -678,6 +678,21 @@ a{ } + .promo-agregators{ + margin-top: 28px; + padding: 32px 28px 32px 28px; + background: #E9EAEB; + } + + .promo-agregators a{ + color: #2D9CDB; + } + + .promo-telega{ + font-weight: bold; + text-transform: uppercase; + } + .wp-block-image IMG{ /** object-fit: cover; */