correct widjet pets

This commit is contained in:
2025-05-09 11:09:48 +03:00
parent 655a492022
commit 14fbcc73de
3 changed files with 15 additions and 6 deletions

View File

@@ -15,14 +15,21 @@ foreach ( $subcats as $cat ) {
}
// Получаем 3 случайных поста из этих категорий
$args = array(
$params = array(
'category__in' => $category_ids,
'posts_per_page' => 3,
'post_status' => 'publish',
'orderby' => 'rand'
'orderby' => 'rand',
'date_query' => array(
array(
'after' => '1 month ago',
'inclusive' => true,
),
),
);
$random_posts = get_posts( $args );
$random_posts = get_posts( $params );
// Если нашли посты
if ( $random_posts ) {
@@ -31,7 +38,7 @@ if ( $random_posts ) {
setup_postdata( $post );
?>
<div class="pets-widget">
<div class="pets-widget<?if ($args['subclass'] !== '') echo ' '.$args['subclass'];?>">
<div class="pets-widget-maintitle"><a href="/pets">Питомцы</a></div>
<a href="<?php the_permalink(); ?>">
<?php if ( has_post_thumbnail() ) : ?>