if template pets in single.php
This commit is contained in:
62
blocks/gamburger-pets.php
Normal file
62
blocks/gamburger-pets.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
if (LANG_VERSION == 'en'){
|
||||
$left_mob_menu = 'leftenmenu';
|
||||
|
||||
$part_title = 'Topics';
|
||||
|
||||
}
|
||||
else{
|
||||
$left_mob_menu = 'leftmenu';
|
||||
$part_title = 'Рубрики';
|
||||
}
|
||||
|
||||
//$menu_items = wp_get_nav_menu_items($gamburger_menu);?>
|
||||
|
||||
<?php $menu_items = wp_get_nav_menu_items('mainmenu-pets');?>
|
||||
|
||||
<div id="mobile_main_menu">
|
||||
|
||||
|
||||
<div class="main_main">
|
||||
|
||||
<ul id="gamburer_menu" class="menu">
|
||||
<li id="rubrics_start"><a href="#"><?=$part_title?><span class="rub_arrow">></span></a></li>
|
||||
<?foreach ($menu_items as $item):?>
|
||||
<li><a href="<?=$item->url?>"><?=$item->title?></a></li>
|
||||
<?endforeach?>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="mob_menu_contacts">
|
||||
<div class="mob_menu_tel">+7 (495) 925 06 34</div>
|
||||
<div class="mob_menu_mail"><a href="maito:info@vetandlife.ru">info@vetandlife.ru</a></div>
|
||||
</div>
|
||||
|
||||
<div class="mob_menu_info">
|
||||
<?php include get_template_directory().'/blocks/mobile-gazeta.php';?>
|
||||
<?php include get_template_directory().'/blocks/mobile-subscript.php';?>
|
||||
<?php include get_template_directory().'/blocks/social-buttons.php';?>
|
||||
</div>
|
||||
|
||||
<?php /**wp_nav_menu( array(
|
||||
'container_class' => 'main_main',
|
||||
'menu' => 'mob_topmenu',
|
||||
'menu_id' => 'gamburer_menu'
|
||||
) ); **/?>
|
||||
<div id="mobile_submenu">
|
||||
<div id="lang_mobile_title"><a href="<?=get_site_url().vij_lang('btn_lan_link', LANG_VERSION)?>"><?=vij_lang('btn_lan', LANG_VERSION)?></a></div>
|
||||
<div id="closed_mobile_menu"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="mobile_rubrics_menu">
|
||||
<div id='rubrics_back'><strong><</strong> <span class="rub_back_title"><?=vij_lang('back_btn_rubric_menu', LANG_VERSION)?></span></div>
|
||||
<?php wp_nav_menu( array(
|
||||
'menu_class'=>'menu_left',
|
||||
'menu'=>'pets-leftmenu'
|
||||
));?>
|
||||
|
||||
<div id="closed_mobile_rubrics_menu"></div>
|
||||
</div>
|
||||
@@ -1,7 +1,7 @@
|
||||
<header class="header-pets">
|
||||
|
||||
|
||||
<?php include TEMPLATEPATH.'/blocks/gamburger.php'; ?>
|
||||
<?php include TEMPLATEPATH.'/blocks/gamburger-pets.php'; ?>
|
||||
|
||||
<div id="petslogo">
|
||||
<a href="<?=home_url();?>/category/pets">
|
||||
@@ -66,8 +66,8 @@
|
||||
<div class="menu-rubrics">
|
||||
|
||||
<?php wp_nav_menu( array(
|
||||
'menu_class'=>'m_rubrics',
|
||||
'menu' => vij_lang('mob_rub_menu', LANG_VERSION)
|
||||
'menu_class'=>'m_rubrics_pets',
|
||||
'menu' => 'pets-mobmenu'
|
||||
));?>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -11,10 +11,17 @@ $miniblock_open = false;?>
|
||||
|
||||
|
||||
<div id="content">
|
||||
|
||||
|
||||
<?$current_category = get_queried_object();
|
||||
$category_id = $current_category->term_id;?>
|
||||
|
||||
<ul id="nav_content">
|
||||
<li><a href="<?=get_home_url()?>">Главная</a></li>
|
||||
<li> - <?single_cat_title()?></li>
|
||||
<?if ($category_id == 14):?>
|
||||
<li>Питомцы</li>
|
||||
<?else:?>
|
||||
<li><a href="<?=get_home_url()?>/category/pets">Питомцы</a></li>
|
||||
<li> - <?single_cat_title()?></li>
|
||||
<?endif?>
|
||||
</ul>
|
||||
|
||||
<?php if(have_posts()) : while(have_posts()) : the_post();?>
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
body {
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.vij-header{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -255,7 +259,48 @@ ul.pets-menu-left{
|
||||
|
||||
.socials-footer-pets{
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
#mainbanner {
|
||||
max-width: 767px;
|
||||
}
|
||||
|
||||
|
||||
.m_rubrics_pets {
|
||||
display: flex;
|
||||
overflow-x: scroll;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
padding-bottom: 20px;
|
||||
margin-left: -20px;
|
||||
margin-bottom: -20px;
|
||||
border-bottom: 1px solid #F2F2F2;
|
||||
}
|
||||
|
||||
.m_rubrics_pets li{
|
||||
font-size: 12px;
|
||||
color: #909294;
|
||||
margin-right: 12px;
|
||||
padding-bottom: 12px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.m_rubrics_pets li a{
|
||||
color: #909294;
|
||||
}
|
||||
|
||||
.m_rubrics_pets li a:hover{
|
||||
color: #F18129;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.m_rubrics_pets li.current-menu-item{
|
||||
color: #171717;
|
||||
font-weight: bold;
|
||||
border-bottom: 3px solid #F18129;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
123
single-pets.php
Normal file
123
single-pets.php
Normal file
@@ -0,0 +1,123 @@
|
||||
<?php get_header();?>
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="content">
|
||||
|
||||
<?//while(have_posts()):?>
|
||||
<?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();
|
||||
?>
|
||||
|
||||
<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>-<li>
|
||||
<li><?=mb_substr(get_the_title(), 0, 50);?>...</li>
|
||||
</ul>
|
||||
|
||||
<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>
|
||||
</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'):?>
|
||||
<div class="post_author">
|
||||
Автор: <?=the_author_posts_link()?>
|
||||
</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;">
|
||||
<p>Читайте нас в <span class="promo-telega"><a href="https://t.me/ViZHuvizh" target="_blank">Telegram</a></span></p>
|
||||
</div>
|
||||
|
||||
<div class="post_panel_info">
|
||||
<div class="post_panel_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>
|
||||
</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;?>
|
||||
|
||||
|
||||
|
||||
<div style="margin-top: 12px;"class="aQKhHt2390"></div>
|
||||
<script>
|
||||
window.k_init = window.k_init || [];
|
||||
k_init.push({
|
||||
id: 'aQKhHt2390',
|
||||
type: 'bn',
|
||||
domain: 'cchdbond.com',
|
||||
refresh: false,
|
||||
next: 0
|
||||
});
|
||||
|
||||
var s = document.createElement('script');
|
||||
s.setAttribute('async', true);
|
||||
s.setAttribute('charset', 'utf-8');
|
||||
s.setAttribute('data-cfasync', false);
|
||||
s.src = 'https://cchdbond.com/qae0820f.js';
|
||||
document.head && document.head.appendChild(s);
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
<?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 get_footer();?>
|
||||
75
single.php
75
single.php
@@ -1,8 +1,38 @@
|
||||
<?php get_header();?>
|
||||
|
||||
|
||||
|
||||
<?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;
|
||||
break; // Мы уже нашли подходящую подрубрику, можно прервать цикл
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$pets_cat = false;
|
||||
}
|
||||
|
||||
echo "<!-- pets_cat: $pets_cat -->";
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
if ( $pets_cat ){
|
||||
get_header( 'pets' );
|
||||
} else {
|
||||
get_header();
|
||||
}?>
|
||||
|
||||
|
||||
<div id="content">
|
||||
|
||||
<?//while(have_posts()):?>
|
||||
@@ -13,15 +43,27 @@
|
||||
$category_id = $category[0]->term_id;
|
||||
$category_link = get_category_link($category_id);
|
||||
$post_id = get_the_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>-<li>
|
||||
<li><?=mb_substr(get_the_title(), 0, 50);?>...</li>
|
||||
</ul>
|
||||
|
||||
if ( $pets_cat ):?>
|
||||
<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>-<li>
|
||||
<li><?=mb_substr(get_the_title(), 0, 50);?>...</li>
|
||||
</ul>
|
||||
<?else:?>
|
||||
<ul id="nav_content">
|
||||
<li><a href="<?=get_site_url()?>">Главная</li>
|
||||
<li>-<li>
|
||||
<li><a href="<?=$category_link?>"><?=$category['0']->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">
|
||||
@@ -117,7 +159,10 @@
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
if ( $pets_cat ){
|
||||
get_footer( 'pets' );
|
||||
} else {
|
||||
get_footer();
|
||||
}?>
|
||||
|
||||
|
||||
|
||||
<?php get_footer();?>
|
||||
|
||||
Reference in New Issue
Block a user