REFACTOR Moving the card into the components subfolder

This commit is contained in:
Antoine M 2026-02-24 17:26:16 +01:00
parent 6d97d1db80
commit 7db5b6c3b3

View File

@ -4,19 +4,24 @@ $current_post_type = $args['current_post_type'] ?? get_post_type();
$types_terms = get_the_terms($ID, 'type');
$type = isset($types_terms[0]) ? $types_terms[0] : null;
$title = get_the_title($ID);
$showExcerpt = $args['show_excerpt'] ?? false;
$excerpt = get_the_excerpt($ID);
$link = get_the_permalink($ID);
$image = get_the_post_thumbnail_url($ID);
$date = get_the_date('F Y', $ID);
$authors = get_field('authors', $ID);
$editors = get_field('editors', $ID);
$numerotation = get_post_meta($ID, 'post_numerotation', true);
$tags = get_the_terms($ID, 'etiquettes');
?>
<div class="post-card post-card--<?php echo $current_post_type; ?> card">
<a class="post-card post-card--<?php echo $current_post_type; ?> card" href="<?php echo $link; ?>">
<?php get_template_part('template-parts/components/content-meta', null, array(
'current_post_type' => $current_post_type,
'current_post_id' => $ID
@ -24,11 +29,13 @@ $numerotation = get_post_meta($ID, 'post_numerotation', true);
<div class="card__inner">
<div class="card__content">
<h3 class="card__title"><?php echo $title; ?></h3>
<div class="card__excerpt"><?php echo $excerpt; ?></div>
<?php if ($showExcerpt) : ?>
<div class="card__excerpt"><?php echo $excerpt; ?></div>
<?php endif; ?>
</div>
<div class="card__details">
<div class="card__details-text">
<div class="post-card__details-text">
<time datetime="<?php echo $date; ?>" class="card__details-date date"><?php echo $date; ?></time>
<?php if ($authors) : ?>
@ -36,6 +43,9 @@ $numerotation = get_post_meta($ID, 'post_numerotation', true);
<?php foreach ($authors as $author) : ?>
<li class="author"><?php echo $author->post_title; ?></li>
<?php endforeach; ?>
<?php foreach ($editors as $editor) : ?>
<li class="editor"><?php echo $editor->post_title; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
@ -44,9 +54,16 @@ $numerotation = get_post_meta($ID, 'post_numerotation', true);
<?php the_post_thumbnail('medium'); ?>
</div>
<?php endif; ?>
<?php if ($tags) : ?>
<ul class="tag-list">
<?php foreach ($tags as $tag) : ?>
<li class="tag-list__tag"><?php echo $tag->name; ?></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
</div>
</div>
</a>