add number arcticle
This commit is contained in:
60
single-3.php
60
single-3.php
@@ -44,9 +44,63 @@ get_header();?>
|
||||
</div>
|
||||
<?endif?>
|
||||
</div>
|
||||
|
||||
<!--<p><small class="text-muted"><?php the_tags('');?></small></p> -->
|
||||
<?//endwhile;?>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<?$posts = get_posts([
|
||||
'tag' => 'номер'.$curr_number['number']
|
||||
]);
|
||||
|
||||
$pitems = [];
|
||||
$endpolosa = 1;
|
||||
|
||||
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);
|
||||
if ($number > $endpolosa ){
|
||||
$endpolosa = $number;
|
||||
}
|
||||
$pitems[$number][] = $post;
|
||||
}
|
||||
}
|
||||
}?>
|
||||
|
||||
<?for ($i = 1; $i <= $endpolosa; $i++) {?>
|
||||
<?if (isset($pitems[$i])):?>
|
||||
<h2 class="part_title">Полоса <?=$i?></h2>
|
||||
<?foreach($pitems[$i] as $item):?>
|
||||
<?$category = get_the_category($item->ID);
|
||||
$category_id = $category[0]->term_id;
|
||||
$category_link = get_category_link($category_id);?>
|
||||
<div class="main-card">
|
||||
<?if ( has_post_thumbnail($item->ID) ) :?>
|
||||
<div class="card-img-top">
|
||||
<a href="<?the_permalink($item->ID);?>"><img class="mini-card-img" src="<?php echo get_the_post_thumbnail_url($item->ID, 'large'); ?>" alt="<?=$item->title;?>"></a>
|
||||
<?if( has_tag( 'видео' ) ):?>
|
||||
<span class="play-card"></span>
|
||||
<?endif?>
|
||||
</div>
|
||||
<?endif?>
|
||||
<div class="main-card-title"><a href="<?the_permalink($item->ID);?>"><?=get_the_title($item->ID);?></a></div>
|
||||
<div class="main-card-body">
|
||||
<div class="main-card-text"><a href="<?the_permalink($item->ID);?>"><?=$item->post_excerpt?></a></div>
|
||||
<div class="news_date"><a href="<?=$category_link?>"><?=$category['0']->name?></a></div>
|
||||
</div>
|
||||
</div>
|
||||
<?endforeach?>
|
||||
<?endif?>
|
||||
<?}?>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
$numbers_year = 2021;
|
||||
|
||||
Reference in New Issue
Block a user