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 <?php
$current_issue = get_queried_object(); $current_issue = get_queried_object();
$issue_related_articles = new WP_Query(array( $issue_related_articles = get_field('articles', $current_issue->ID);
'post_type' => 'articles',
'posts_per_page' => 3,
'orderby' => 'date',
'order' => 'DESC',
'meta_query' => array(
array(
'key' => 'related_revue',
'value' => $current_issue->ID,
'compare' => '=',
),
),
));
$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"> <div class="page--single-revue">
<?php if (have_posts()) : ?> <?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?> <?php while (have_posts()) : the_post(); ?>
<section class="single-revue__header "> <?php get_template_part('template-parts/revues/single-revue__header'); ?>
<div class="single-revue__header__inner ">
<div class="content"> <div class="content-wrapper">
<div class="content-meta"> <div class="sidebar">
<span class="content-meta__type content-meta__type--revue">Revue</span> <div class="search-field">
<input type="text" placeholder="Rechercher">
</div> </div>
<h1> <?php the_title(); ?></h1> <?php
<div class="revue-meta"> $tags = get_terms(array(
<p class="revue-issue"> 'taxonomy' => 'etiquettes',
<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"> <?php if ($tags) : ?>
<p class="revue-date-label revue-meta__label">Publication</p> <div class="tags">
<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> <h3 class="tags__title">Tags</h3>
</div> <ul class="tags-list">
<div class="revue-date-info"> <?php foreach ($tags as $tag) : ?>
<p class="revue-date-label revue-meta__label">Mis à jour</p> <li>
<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> <a class="article-tag" href="<?php echo get_term_link($tag); ?>"><?php echo $tag->name; ?></a>
</div> </li>
</div> <?php endforeach; ?>
</div> <?php endif; ?>
<div class="thumbnail-wrapper"> </ul>
<?php the_post_thumbnail('full', ['class' => 'thumbnail']); ?>
</div> </div>
</div> </div>
<div class="revue-content">
</section> <details class="edito" open="true">
<?php if ($issue_related_articles->have_posts()) : ?> <summary>
<?php while ($issue_related_articles->have_posts()) : $issue_related_articles->the_post(); ?> <h2 class="edito__title">
<?php $terms = get_the_terms($post->ID, 'etiquettes'); ?> 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>
</summary>
<div class="edito__content-wrapper">
<div class="edito__content">
<article class="single-revue__articles"> <?php the_excerpt(); ?>
<h2 class="single-revue__articles__title article-title"> <?php echo get_the_title($article); ?></h2> <div class="edito__cta">
<ul class="single-revue__articles__tags article-tags-list"> <button class="cta cta--primary">Bonne Lecture</button>
<?php foreach ($terms as $term) : ?> </div>
<li class="single-revue__articles__tag article-tag"> <?php echo $term->name; ?></li> </div>
</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; ?> <?php endforeach; ?>
</ul> </ul>
</section>
</div>
</div>
<!-- #### 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>
</div> </div>