add block partname in pets
This commit is contained in:
28
single.php
28
single.php
@@ -13,14 +13,18 @@
|
||||
foreach ($post_categories as $post_category) {
|
||||
if ($post_category->parent == $pets_category->term_id) {
|
||||
$pets_cat = true;
|
||||
break; // Мы уже нашли подходящую подрубрику, можно прервать цикл
|
||||
$category_id = $post_category->term_id;
|
||||
$category_name = $post_category->name;
|
||||
$category_link = get_category_link($category_id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$pets_cat = false;
|
||||
$pets_cat = false;
|
||||
}
|
||||
|
||||
echo "<!-- pets_cat: $pets_cat -->";
|
||||
$post_id = get_the_ID();
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -39,25 +43,27 @@ if ( $pets_cat ){
|
||||
<?the_post();?>
|
||||
|
||||
|
||||
<?php $category = get_the_category();
|
||||
$category_id = $category[0]->term_id;
|
||||
$category_link = get_category_link($category_id);
|
||||
$post_id = get_the_ID();
|
||||
<?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?>"><?=$category['0']->name;?></a></li>
|
||||
<li><a href="<?=$category_link?>"><?echo $category_name;?></a></li>
|
||||
<li>-<li>
|
||||
<li><?=mb_substr(get_the_title(), 0, 50);?>...</li>
|
||||
</ul>
|
||||
<?else:?>
|
||||
<?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['0']->name;?></a></li>
|
||||
<li><a href="<?=$category_link?>"><?=$category_name;?></a></li>
|
||||
<li>-<li>
|
||||
<li><?=mb_substr(get_the_title(), 0, 50);?>...</li>
|
||||
</ul>
|
||||
@@ -67,7 +73,7 @@ if ( $pets_cat ){
|
||||
|
||||
<div class="post_info">
|
||||
<div class="post_info_sub">
|
||||
<span class="post_link_category"><a href="<?=$category_link?>"><?=$category['0']->name;?></a></span>, <nobr><?php the_time('j F Y, G:i');?></nobr>
|
||||
<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';?>
|
||||
|
||||
Reference in New Issue
Block a user