REFACTOR Component with a lastest-parutions sub-component template parts for better readability
This commit is contained in:
parent
757d5e9581
commit
c3333cf403
|
|
@ -17,67 +17,15 @@
|
|||
)
|
||||
)); ?>
|
||||
|
||||
<div class="latest-parutions">
|
||||
<h2 class="latest-parutions__title title-small">Dernière parution</h2>
|
||||
<?php
|
||||
$latest_analyse = get_posts(array(
|
||||
'posts_per_page' => 1, // Number of recent posts thumbnails to display
|
||||
'post_status' => 'publish', // Show only the published posts
|
||||
<?php get_template_part('template-parts/components/archive/latest-parutions', null, array(
|
||||
'post_amount' => 1,
|
||||
'post_type' => 'analyses-etudes',
|
||||
'orderby' => 'date',
|
||||
'order' => 'DESC',
|
||||
'tax_query' => array(
|
||||
array(
|
||||
'taxonomy' => 'type',
|
||||
'field' => 'slug',
|
||||
'terms' => 'analyse',
|
||||
),
|
||||
),
|
||||
));
|
||||
$latest_etude = get_posts(array(
|
||||
'posts_per_page' => 1, // Number of recent posts thumbnails to display
|
||||
'post_status' => 'publish', // Show only the published posts
|
||||
'post_type' => 'analyses-etudes',
|
||||
'orderby' => 'date',
|
||||
'order' => 'DESC',
|
||||
'tax_query' => array(
|
||||
array(
|
||||
'taxonomy' => 'type',
|
||||
'field' => 'slug',
|
||||
'terms' => 'etude',
|
||||
),
|
||||
),
|
||||
));
|
||||
$recent_posts = array_merge($latest_analyse, $latest_etude);
|
||||
|
||||
?>
|
||||
<?php foreach ($recent_posts as $post) : ?>
|
||||
<?php
|
||||
$type = get_the_terms($post->ID, 'type');
|
||||
?>
|
||||
<div class="post-card post-card--analyses-etudes">
|
||||
<?php if (is_array($type) && !empty($type) && isset($type[0]->name)) : ?>
|
||||
<div class="latest-parution__item">
|
||||
<div class="content-meta">
|
||||
<span class="content-meta__type content-meta__type--revue"><?php echo $type[0]->name; ?></span>
|
||||
<p class="content-meta__revue-issue content-meta__revue-issue--green">
|
||||
<span class="revue-issue-number revue-meta__label sr-only">Numéro</span>
|
||||
28
|
||||
</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<a href="<?php echo get_the_permalink($post->ID); ?>">
|
||||
<?php echo get_the_post_thumbnail($post->ID, 'medium'); ?>
|
||||
<h3><?php echo get_the_title($post->ID); ?></h3>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- #### ANALYSES ET ETUDES POST GRID #### -->
|
||||
<?php get_template_part('template-parts/analyses-etudes/analyses-etudes-grid'); ?>
|
||||
<?php get_template_part('template-parts/post-types/analyses-etudes/analyses-etudes-grid'); ?>
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user