REFACTORING and ehancing FEATURES

This commit is contained in:
Antoine M 2025-06-09 14:56:54 +02:00
parent c0e14a39e6
commit 34f2672aec

View File

@ -3,19 +3,7 @@
<?php
$current_issue = get_queried_object();
$issue_related_articles = new WP_Query(array(
'post_type' => 'articles',
'posts_per_page' => 3,
'orderby' => 'date',
'order' => 'DESC',
'meta_query' => array(
array(
'key' => 'related_revue',
'value' => $current_issue->ID,
'compare' => '=',
),
),
));
$issue_related_articles = get_field('articles', $current_issue->ID);
$articles = get_field('articles', $current_issue->ID);
?>
@ -23,53 +11,82 @@ $articles = get_field('articles', $current_issue->ID);
<div class="page--single-revue">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<section class="single-revue__header ">
<div class="single-revue__header__inner ">
<div class="content">
<div class="content-meta">
<span class="content-meta__type content-meta__type--revue">Revue</span>
<?php get_template_part('template-parts/revues/single-revue__header'); ?>
<div class="content-wrapper">
<div class="sidebar">
<div class="search-field">
<input type="text" placeholder="Rechercher">
</div>
<?php
$tags = get_terms(array(
'taxonomy' => 'etiquettes',
));
?>
<?php if ($tags) : ?>
<div class="tags">
<h3 class="tags__title">Tags</h3>
<ul class="tags-list">
<?php foreach ($tags as $tag) : ?>
<li>
<a class="article-tag" href="<?php echo get_term_link($tag); ?>"><?php echo $tag->name; ?></a>
</li>
<?php endforeach; ?>
<?php endif; ?>
</ul>
</div>
<h1> <?php the_title(); ?></h1>
<div class="revue-meta">
<p class="revue-issue">
<span class="revue-issue-label revue-meta__label">Numéro</span>
<span class="revue-issue-number revue-meta__value">25</span>
</p>
<div class="revue-date-info">
<p class="revue-date-label revue-meta__label">Publication</p>
<time class="revue-publish-date revue-meta__value" datetime="<?php echo get_the_date('Y-m-d'); ?>"><?php echo get_the_date('d F Y'); ?></time>
</div>
<div class="revue-content">
<details class="edito" open="true">
<summary>
<h2 class="edito__title">
Edito
</h2>
<div class="open-close-icon">
<img src="https://homegrade.brussels/wp-content/themes/Deligraph_Homegrade/resources/img/graphic-assets/chevron_down.svg" class="open-close-cta" alt="">
</div>
<div class="revue-date-info">
<p class="revue-date-label revue-meta__label">Mis à jour</p>
<time class="revue-update-date revue-meta__value" datetime="<?php echo get_the_modified_date('Y-m-d'); ?>"><?php echo get_the_modified_date('d F Y'); ?></time>
</summary>
<div class="edito__content-wrapper">
<div class="edito__content">
<?php the_excerpt(); ?>
<div class="edito__cta">
<button class="cta cta--primary">Bonne Lecture</button>
</div>
</div>
</div>
</div>
<div class="thumbnail-wrapper">
<?php the_post_thumbnail('full', ['class' => 'thumbnail']); ?>
</div>
</details>
<section class="table-matieres">
<h2 class="table-matieres__title">Table des matières</h2>
<ul class="post-grid__list article-grid__list">
<?php foreach ($issue_related_articles as $article) : ?>
<?php get_template_part('template-parts/articles/card-article', null, array(
'date' => $article->post_date,
'image' => get_the_post_thumbnail_url($article->ID),
'link' => get_the_permalink($article->ID),
'ID' => $article->ID
)); ?>
<?php endforeach; ?>
</ul>
</section>
</div>
</section>
<?php if ($issue_related_articles->have_posts()) : ?>
<?php while ($issue_related_articles->have_posts()) : $issue_related_articles->the_post(); ?>
<?php $terms = get_the_terms($post->ID, 'etiquettes'); ?>
</div>
<article class="single-revue__articles">
<h2 class="single-revue__articles__title article-title"> <?php echo get_the_title($article); ?></h2>
<ul class="single-revue__articles__tags article-tags-list">
<?php foreach ($terms as $term) : ?>
<li class="single-revue__articles__tag article-tag"> <?php echo $term->name; ?></li>
<?php endforeach; ?>
</ul>
<!-- #### EXPLORE TAGS #### -->
<?php get_template_part('template-parts/components/explore-tags'); ?>
<!-- #### INFOLETTRE #### -->
<?php get_template_part('template-parts/components/subscribe-infolettre'); ?>
<p class="single-revue__articles__excerpt"> <?php the_content(); ?></p>
</article>
<?php endwhile; ?>
<?php endif; ?>
</div>
</div>