new page number

This commit is contained in:
arlemp@selectel.ru
2021-11-21 13:14:07 +03:00
parent c15ec37abb
commit 65816f81e7
5 changed files with 161 additions and 3 deletions

View File

@@ -7,8 +7,6 @@
get_header(); get_header();
$nn = 0;?> $nn = 0;?>
<div id="content"> <div id="content">
<ul id="nav_content"> <ul id="nav_content">

View File

@@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <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"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title><?php wp_title('|', true, 'right');?><?=get_bloginfo('name')?></title> <title><?php wp_title('|', true, 'right');?><?=get_bloginfo('name')?></title>
<link rel="stylesheet" href="<?php echo get_stylesheet_uri();?>?ver=64"> <link rel="stylesheet" href="<?php echo get_stylesheet_uri();?>?ver=65">
<link href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" rel="stylesheet"> <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/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> <script type='text/javascript' src="<?php echo get_stylesheet_directory_uri()?>/scripts/burger-menu.js?ver=9"></script>

31
helpers/number_title.php Normal file
View File

@@ -0,0 +1,31 @@
<?php
function number_pdf($title){
$items = explode(' ', $title);
$number = substr($items[2], 1, strlen($items[2]) - 2);
//echo $number;
$name = 'vizh_'.$number.'_'.ru2enmonths($items[3]).'_'.$items[4];
$findpdf = db_get("SELECT * FROM `wp_posts` WHERE `post_name` = '$name' ORDER BY `post_modified` DESC LIMIT 1");
if (isset($findpdf ['guid']))
return $findpdf ['guid'];
return '';
}
function ru2enmonths($str){
$ruMonths = ['январь', 'февраль', 'март', 'апрель', 'май', 'июнь', 'июль', 'август', 'сентябрь', 'октябрь', 'ноябрь', 'декабрь'];
$enMonths = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december'];
$enDate = str_ireplace($ruMonths, $enMonths, $str);
return $enDate;
}

86
single-3.php Normal file
View File

@@ -0,0 +1,86 @@
<?php
require TEMPLATEPATH.'/helpers/number_title.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()?>">Главная</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>
<?$current_pdf = number_pdf(get_the_title())?>
<h1 class="post-h1">Федеральное отраслевое издание «Ветеринария и жизнь»</h1>
<div class="current-number">
<?if ( has_post_thumbnail() ) :?>
<div class="number-img">
<img class="img-fluid rounded" src="<?php echo get_the_post_thumbnail_url(null, 'full');?>" alt="<?the_title();?>">
</div>
<div class="number_title">
<div class="number_number"><?the_title()?></div>
<?if ($current_pdf !== ''):?>
<div>
<a href="<?=$current_pdf?>" class="orange_button" target="_blank">Читать PDF версию</a>
</div>
<!-- <button class="sub_button" onclick="location.href='<?=$current_pdf?>'" type="button">Читать PDF версию</button> -->
<?endif?>
</div>
<?endif?>
</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> -->
<?//endwhile;?>
<?php include get_template_directory().'/blocks/yets.php';?>
<div id="tags">
<?php the_tags();?>
</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>, <?php the_time('j F Y, G:i');?>
</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>
<?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();?>

View File

@@ -414,12 +414,55 @@ a{
} }
.orange_button {
background: #F18129;
border-radius: 55px;
border: 1px solid #F18129;
color: white;
padding: 20px 28px;
text-align: center;
text-decoration: none;
text-transform: uppercase;
font-weight: bold;
display: inline-block;
font-size: 16px;
font-size: 11px;
line-height: 110%;
height: 55px;
}
.vazh{ .vazh{
font-size: 9px; font-size: 9px;
text-transform: uppercase; text-transform: uppercase;
letter-spacing: 0.45em; letter-spacing: 0.45em;
} }
.current-number{
display: flex;
align-items: center;
margin-top: 42px;
margin-bottom: 42px;
}
.number-img{
width: 147px;
}
.number_title{
display: flex;
justify-content: center;
align-items: center;
font-size: 16px;
font-weight: bold;
background: #F5F5F5;
width: 768px;
height: 128px;
}
.number_number{
width: 50%;
}
#footer_2{ #footer_2{
display: flex; display: flex;
justify-content: center; justify-content: center;