carhop__carhop-theme__DEV/template-parts/components/cards/communique-presse-card.php

33 lines
1.3 KiB
PHP

<?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>