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