correct number tags
This commit is contained in:
25
single-3.php
25
single-3.php
@@ -1,4 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
// Включить отображение всех типов ошибок
|
||||||
|
//ini_set('display_errors', 1);
|
||||||
|
//ini_set('display_startup_errors', 1);
|
||||||
|
//error_reporting(E_ALL);
|
||||||
|
|
||||||
require TEMPLATEPATH.'/helpers/number_title.php';
|
require TEMPLATEPATH.'/helpers/number_title.php';
|
||||||
|
|
||||||
get_header();?>
|
get_header();?>
|
||||||
@@ -61,23 +68,31 @@ get_header();?>
|
|||||||
$pitems = [];
|
$pitems = [];
|
||||||
$endpolosa = 1;
|
$endpolosa = 1;
|
||||||
|
|
||||||
|
if ( !empty($posts) ) {
|
||||||
|
|
||||||
foreach ($posts as $post){
|
foreach ($posts as $post){
|
||||||
|
|
||||||
$posttags = get_the_tags($post->ID);
|
$posttags = get_the_tags($post->ID);
|
||||||
|
|
||||||
foreach ($posttags as $tag){
|
foreach ($posttags as $tag){
|
||||||
$pfind = strpos($tag->name, 'полоса');
|
$pfind = strpos($tag->name, 'полоса');
|
||||||
|
|
||||||
if ($pfind !== false) {
|
if ($pfind !== false) {
|
||||||
$number = substr($tag->name, 0, $pfind);
|
|
||||||
|
$number = (int)substr($tag->name, 0, $pfind);
|
||||||
|
|
||||||
if ($number > $endpolosa ){
|
if ($number > $endpolosa ){
|
||||||
$endpolosa = $number;
|
$endpolosa = $number;
|
||||||
}
|
}
|
||||||
$pitems[$number][] = $post;
|
$pitems[$number][] = $post;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}?>
|
|
||||||
|
|
||||||
<?for ($i = 1; $i <= $endpolosa; $i++) {?>
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?for ($i = 1; $i <= $endpolosa; $i++) {?>
|
||||||
<?if (isset($pitems[$i])):?>
|
<?if (isset($pitems[$i])):?>
|
||||||
<!--<h2 class="part_title">Полоса <?=$i?></h2>-->
|
<!--<h2 class="part_title">Полоса <?=$i?></h2>-->
|
||||||
<?foreach($pitems[$i] as $item):?>
|
<?foreach($pitems[$i] as $item):?>
|
||||||
@@ -97,10 +112,10 @@ get_header();?>
|
|||||||
<div class="news_date"><a href="<?=$category_link?>"><?=$category['0']->name?></a></div>
|
<div class="news_date"><a href="<?=$category_link?>"><?=$category['0']->name?></a></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?endforeach?>
|
<?endforeach?>
|
||||||
<?endif?>
|
<?endif?>
|
||||||
<?}?>
|
<?}
|
||||||
|
}?>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user