178 lines
5.8 KiB
PHP
178 lines
5.8 KiB
PHP
<?php
|
||
|
||
// Указываем ID или slug основной рубрики
|
||
$pets_cat = false;
|
||
$pets_category_id_or_slug = 'pets';
|
||
|
||
// Получаем объект основной рубрики
|
||
$pets_category = get_term_by('slug', $pets_category_id_or_slug, 'category');
|
||
|
||
$post_categories = get_the_terms(get_the_ID(), 'category');
|
||
|
||
if ($post_categories && !is_wp_error($post_categories)) {
|
||
foreach ($post_categories as $post_category) {
|
||
if ($post_category->parent == $pets_category->term_id) {
|
||
$pets_cat = true;
|
||
$category_id = $post_category->term_id;
|
||
$category_name = $post_category->name;
|
||
$category_link = get_category_link($category_id);
|
||
break;
|
||
}
|
||
}
|
||
} else {
|
||
$pets_cat = false;
|
||
}
|
||
|
||
$post_id = get_the_ID();
|
||
|
||
|
||
?>
|
||
|
||
|
||
<?php
|
||
if ( $pets_cat ){
|
||
get_header( 'pets' );
|
||
} else {
|
||
get_header();
|
||
}?>
|
||
|
||
|
||
<div id="content">
|
||
|
||
<?//while(have_posts()):?>
|
||
<?the_post();?>
|
||
|
||
|
||
<?php
|
||
|
||
|
||
if ( $pets_cat ):?>
|
||
<?echo "<!-- pets: $category_name-->"?>
|
||
<ul id="nav_content">
|
||
<li><a href="<?=get_site_url()?>/category/pets">Питомцы</li>
|
||
<li>-<li>
|
||
<li><a href="<?=$category_link?>"><?echo $category_name;?></a></li>
|
||
<li>-<li>
|
||
<li><?=mb_substr(get_the_title(), 0, 50);?>...</li>
|
||
</ul>
|
||
<?else:
|
||
$category = get_the_category();
|
||
$category_id = $category[0]->term_id;
|
||
$category_name = $category['0']->name;
|
||
$category_link = get_category_link($category_id);?>
|
||
<ul id="nav_content">
|
||
<li><a href="<?=get_site_url()?>">Главная</li>
|
||
<li>-<li>
|
||
<li><a href="<?=$category_link?>"><?=$category_name;?></a></li>
|
||
<li>-<li>
|
||
<li><?=mb_substr(get_the_title(), 0, 50);?>...</li>
|
||
</ul>
|
||
<?endif?>
|
||
|
||
|
||
|
||
<div class="post_info">
|
||
<div class="post_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>
|
||
</div>
|
||
<div class="post_info_sub post_info_social">
|
||
<?php include get_template_directory().'/blocks/social-share.php';?>
|
||
</div>
|
||
</div>
|
||
<div id="fulltext">
|
||
<h1 class="post-h1"><?php wp_title('');?></h1>
|
||
<?$author = get_the_author();
|
||
if ( ! empty ( $author ) AND $author !== 'vetandlife.ru' AND $author !== 'Анна Купровская'):
|
||
$author_bio = get_the_author_meta('description', $author_id);?>
|
||
<div class="post_author">
|
||
Автор: <?=the_author_posts_link()?>
|
||
<?if (!empty($author_bio)):?>
|
||
<div class="post_author_sub"><?=$author_bio?></div>
|
||
<?endif?>
|
||
</div>
|
||
<?endif?>
|
||
|
||
<div class="publ_expert"><?php the_excerpt();?></div>
|
||
<?if ( has_post_thumbnail() ) :?>
|
||
<div id="post-img">
|
||
<img class="img-fluid rounded" src="<?php echo get_the_post_thumbnail_url(null, 'full');?>" alt="<?the_title();?>">
|
||
</div>
|
||
<div class="post_img_title"><?the_post_thumbnail_caption()?></div>
|
||
<?endif?>
|
||
<div class="fulltext">
|
||
<?the_content();?>
|
||
</div>
|
||
|
||
<div class="promo-agregators" style="text-align: center;">
|
||
<?if ( $pets_cat ):?>
|
||
<p>Читайте нас в <span class="promo-telega"><a href="https://t.me/pitomcy_vetandlife" target="_blank">Telegram</a></span></p>
|
||
<?else:?>
|
||
<p>Читайте нас в <span class="promo-telega"><a href="https://t.me/ViZHuvizh" target="_blank">Telegram</a></span></p>
|
||
<?endif?>
|
||
</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>
|
||
</div>
|
||
<div class="post_panel_info_sub">
|
||
<!--Поделиться <i class="fas fa-share-square btn_soc_post"></i>--> <?php include get_template_directory().'/blocks/social-share.php';?>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="promo-poll">
|
||
<strong>Какие новости интересны читателям «Ветеринарии и жизни»? <a href="https://vetandlife.ru/polls/opros-kakie-novosti-interesny-chitatelyam-veterinarii-i-zhizni/">Пройти опрос</a></strong>
|
||
</div>
|
||
|
||
|
||
<!--<p><small class="text-muted"><?php the_tags('');?></small></p> -->
|
||
<?//endwhile;?>
|
||
|
||
|
||
<?if (function_exists('ex_adv_get_banner')):
|
||
|
||
//место под новостью 1
|
||
$ya_news = ex_adv_get_banner( 11 );
|
||
if ($ya_news !== ''):?>
|
||
<?=$ya_news?>
|
||
<?endif?>
|
||
|
||
<?//место под новостью 2
|
||
//$smi = ex_adv_get_banner( 12 );
|
||
//if ($smi !== ''):?>
|
||
<?//=$smi?>
|
||
<?//endif?>
|
||
|
||
<?endif?>
|
||
|
||
|
||
<?php include get_template_directory().'/blocks/yets.php';?>
|
||
|
||
<div id="tags">
|
||
<?php the_tags();?>
|
||
</div>
|
||
|
||
|
||
</div>
|
||
|
||
<?php include get_template_directory().'/blocks/moread.php';?>
|
||
|
||
<div class="publ-to-main">
|
||
<button class="more_button" onclick="location.href='<?=get_site_url()?>/page/2'" type="button">
|
||
На главную</button>
|
||
</div>
|
||
|
||
|
||
|
||
</div>
|
||
|
||
|
||
|
||
<?php
|
||
if ( $pets_cat ){
|
||
get_footer( 'pets' );
|
||
} else {
|
||
get_footer();
|
||
}?>
|
||
|