FEATURE Handling a variation for the post type analyse-etude post types to get the two last analyse and etude with a dedicated function

This commit is contained in:
Antoine M 2026-02-24 15:08:18 +01:00
parent 95f21975bc
commit 44a6c0ef03

View File

@ -10,6 +10,12 @@ $posts_query = new WP_Query(array(
'order' => 'DESC', 'order' => 'DESC',
)); ));
if ($post_type === 'analyses-etudes') :
$posts_query = get_last_analyses_etudes_posts();
endif;
$posts = $posts_query->posts; $posts = $posts_query->posts;
$current_post_type = $args['current_post_type'] ?? get_post_type(); $current_post_type = $args['current_post_type'] ?? get_post_type();
@ -24,8 +30,8 @@ $current_post_type = $args['current_post_type'] ?? get_post_type();
<?php endif; ?> <?php endif; ?>
<?php foreach ($posts as $post) : ?> <?php foreach ($posts as $post) : ?>
<?php get_template_part('template-parts/components/post-card', null, array( <?php get_template_part('template-parts/components/cards/post-card', null, array(
'ID' => get_the_ID(), 'ID' => $post->ID,
)); ?> )); ?>
<?php endforeach; ?> <?php endforeach; ?>
</div> </div>