add subtemplates and block promo smm
This commit is contained in:
@@ -51,16 +51,52 @@ function mob_block($template){
|
||||
|
||||
|
||||
//свой шаблон для категории
|
||||
add_filter( 'single_template', function ( $single_template ) {
|
||||
add_filter('category_template', function (){
|
||||
|
||||
$category = get_queried_object();
|
||||
$parent_id = $category->category_parent; // ID родителя
|
||||
|
||||
foreach( (array) get_the_category() as $cat ) {
|
||||
$template = array(); //массив для поиска шаблонов
|
||||
|
||||
if ( file_exists(TEMPLATEPATH . "/single-{$cat->slug}.php") )
|
||||
return TEMPLATEPATH . "/single-{$cat->slug}.php";
|
||||
$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( $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;
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<title><?php wp_title('|', true, 'right');?><?=get_bloginfo('name')?></title>
|
||||
<link rel="stylesheet" href="<?php echo get_stylesheet_uri();?>?ver=52">
|
||||
<link rel="stylesheet" href="<?php echo get_stylesheet_uri();?>?ver=53">
|
||||
<link href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" rel="stylesheet">
|
||||
<script type='text/javascript' src="<?php echo get_stylesheet_directory_uri()?>/scripts/jquery-3.6.0.min.js"></script>
|
||||
<script type='text/javascript' src="<?php echo get_stylesheet_directory_uri()?>/scripts/burger-menu.js?ver=9"></script>
|
||||
|
||||
@@ -47,7 +47,9 @@
|
||||
<?endif?>
|
||||
<div class="fulltext">
|
||||
<?the_content();?>
|
||||
<p>Свежие отраслевые новости на нашем канале в <a href="https://t.me/ViZHuvizh" target="_blank">Telegram</a></p>
|
||||
</div>
|
||||
<div class="promo-agregators">
|
||||
<p>Свежие отраслевые новости на нашем канале в <span class="promo-telega"><a href="https://t.me/ViZHuvizh" target="_blank">Telegram</a></span></p>
|
||||
<p>Добавьте «Ветеринарию и жизнь» в избранное в <a href="https://yandex.ru/news/?favid=254162793" target="_blank"><span style="color:red; font-weight: bold;">Я</span><span style="font-weight: bold; color:black;">НДЕКС.НОВОСТИ</span></a></p>
|
||||
</div>
|
||||
<!--<p><small class="text-muted"><?php the_tags('');?></small></p> -->
|
||||
|
||||
Reference in New Issue
Block a user