FEATURE Refining the block to display the correct post types

This commit is contained in:
Antoine M 2026-05-13 11:52:45 +02:00
parent d657b68a9d
commit a93592ea45
2 changed files with 12 additions and 8 deletions

View File

@ -7,7 +7,7 @@ $featured_items = array();
// QUERY ACTUALITES et AJOUT DES POSTS AU TABLEAU $featured_items
switch_to_blog(1);
$actualites = new WP_Query(array(
'post_type' => 'post',
'post_type' => 'actualites',
'post_status' => 'publish',
'posts_per_page' => $limit,
'orderby' => 'date',
@ -61,9 +61,8 @@ restore_current_blog();
return $b['timestamp'] <=> $a['timestamp'];
});
$featured_items = \array_slice($featured_items, 0, $limit);
?>
<section class="featured-news alignfull has-background" <?php echo get_block_wrapper_attributes(); ?>>
<div class="featured-news__inner">
@ -87,10 +86,13 @@ $featured_items = \array_slice($featured_items, 0, $limit);
$did_switch = true;
}
get_template_part('template-parts/dynamiques/article-card', null, array(
get_template_part('template-parts/components/cards/slider-card', null, array(
'ID' => $item['id'],
'isSwiperSlide' => true,
'showCover' => true,
'showTags' => false,
));
if ($did_switch) {

View File

@ -7,7 +7,7 @@ $featured_items = array();
// QUERY ACTUALITES et AJOUT DES POSTS AU TABLEAU $featured_items
switch_to_blog(1);
$actualites = new WP_Query(array(
'post_type' => 'post',
'post_type' => 'actualites',
'post_status' => 'publish',
'posts_per_page' => $limit,
'orderby' => 'date',
@ -61,9 +61,8 @@ restore_current_blog();
return $b['timestamp'] <=> $a['timestamp'];
});
$featured_items = \array_slice($featured_items, 0, $limit);
?>
<section class="featured-news alignfull has-background" <?php echo get_block_wrapper_attributes(); ?>>
<div class="featured-news__inner">
@ -87,10 +86,13 @@ $featured_items = \array_slice($featured_items, 0, $limit);
$did_switch = true;
}
get_template_part('template-parts/dynamiques/article-card', null, array(
get_template_part('template-parts/components/cards/slider-card', null, array(
'ID' => $item['id'],
'isSwiperSlide' => true,
'showCover' => true,
'showTags' => false,
));
if ($did_switch) {