REFACTOR Moving the card into the components subfolder

This commit is contained in:
Antoine M 2026-02-24 17:27:19 +01:00
parent 1e62d7b38c
commit 9fe976e115
2 changed files with 33 additions and 26 deletions

View File

@ -1,26 +0,0 @@
<?php
$communique_id = $args['communique_id'];
$communique_file = get_field('file', $communique_id);
$communique_file_url = $communique_file['url'];
$communique_file_size = size_format($communique_file['filesize']);
$communique_file_type = $communique_file['subtype'];
?>
<div class="communique-card">
<?php get_template_part('template-parts/components/content-meta', null, array(
'current_post_type' => 'communique-presse',
'current_post_id' => $communique_id
)); ?>
<h3><?php echo get_the_title($communique_id); ?></h3>
<div class="communique-card__file-infos">
<time datetime="<?php echo get_the_date('Y-m-d', $communique_id); ?>"><?php echo get_the_date('d F Y', $communique_id); ?></time>
<?php if ($communique_file) : ?>
<span>|</span>
<span class="communique-card__file-type"><?php echo $communique_file_type; ?></span>
<span class="communique-card__file-size">(<?php echo $communique_file_size; ?>)</span>
<?php endif; ?>
</div>
<!-- <a href="<?php echo get_permalink($communique_id); ?>" class="button">Voir le communiqué</a> -->
</div>

View File

@ -0,0 +1,33 @@
<?php
$communique_id = $args['communique_id'];
$communique_file = get_field('file', $communique_id);
$communique_file_url = $communique_file['url'];
$communique_file_size = size_format($communique_file['filesize']);
$communique_file_type = $communique_file['subtype'];
?>
<div class="communique-card">
<?php get_template_part('template-parts/components/content-meta', null, array(
'current_post_type' => 'communique-presse',
'current_post_id' => $communique_id
)); ?>
<div class="communique-card__inner">
<div class="communique-card__content">
<h3><?php echo get_the_title($communique_id); ?></h3>
<div class="communique-card__file-infos">
<time datetime="<?php echo get_the_date('Y-m-d', $communique_id); ?>"><?php echo get_the_date('d F Y', $communique_id); ?></time>
<?php if ($communique_file) : ?>
<span>|</span>
<span class="communique-card__file-type"><?php echo $communique_file_type; ?></span>
<span class="communique-card__file-size">(<?php echo $communique_file_size; ?>)</span>
<?php endif; ?>
</div>
</div>
<?php get_template_part('template-parts/components/cta--download', null, array(
'url' => $communique_file_url,
'alt' => 'Télécharger le communiqué',
'target' => '_blank',
)); ?>
</div>
</div>