add moread_all

This commit is contained in:
2026-03-18 22:58:41 +03:00
parent 09ef3e1d6d
commit db4a7c7c38
13 changed files with 214 additions and 230 deletions

54
blocks/moread_all.php Normal file
View File

@@ -0,0 +1,54 @@
<?php
$args = wp_parse_args($args, array(
'posts_limit' => 8,
'category_id' => 2
));
$query = new WP_Query(
array(
'category__in' => array($args['category_id']),
'posts_per_page' => $args['posts_limit'],
'meta_query' => array(
array(
'key' => '_thumbnail_id',
//'compare' => 'EXISTS'
)
)
)
); # фильтруем рубрики
?>
<?php if($query->have_posts()) : ?>
<div class="mini-card-block">
<?php while($query->have_posts()) : $query->the_post();?>
<div class="mini-card">
<?if ( has_post_thumbnail() ) :?>
<div class="mini-card-img">
<a href="<?the_permalink();?>">
<?$imgurl = IMGSERVER.'news/512x340/'.str_replace('https://vetandlife.ru/wp-content/uploads/', '', get_the_post_thumbnail_url(null, 'full'))?>
<img class="mini-card-img" src="<?=$imgurl;?>" alt="<?the_title();?>">
<?if( has_tag( 'видео' ) ):?>
<span class="play-card"></span>
<?endif?>
</a>
</div>
<?endif?>
<h2 class="mini-card-title"><a href="<?the_permalink();?>"><?the_title();?></a></h2>
<div class="mini-card-body">
<div class="news_date"><?the_time('j F Y, G:i');?></div>
</div>
</div>
<?php endwhile;?>
</div>
<?endif?>