updating chapter header with better to improve flexibility

This commit is contained in:
Antoine M 2023-10-27 16:08:06 +02:00
parent 2528e25b65
commit ecf0cc70af
2 changed files with 19 additions and 13 deletions

View File

@ -25,9 +25,9 @@
.cta { .cta {
@apply my-8; @apply my-8;
} }
time { /* time {
@apply bg-white block py-2 mt-6 px-6 w-fit rounded-3xl; @apply bg-white block py-2px-6 w-fit rounded-3xl;
} } */
} }
/* .post-conseil-page--acoustique & { /* .post-conseil-page--acoustique & {

View File

@ -1,15 +1,16 @@
<?php <?php
$thematique = get_the_terms($args->ID, 'thematiques')[0] ?? null; $thematique = get_the_terms($args['ID'], 'thematiques')[0] ?? null;
$thematique_generale = $thematique->parent ? get_term($thematique->parent, 'thematiques') : $thematique; $thematique_generale = $thematique->parent ? get_term($thematique->parent, 'thematiques') : $thematique;
$thematique_generale_id_fr = apply_filters('wpml_object_id', $thematique_generale->term_id, 'thematiques', TRUE, 'fr'); $thematique_generale_id_fr =
apply_filters('wpml_object_id', $thematique_generale->term_id, 'thematiques', TRUE, 'fr');
// Récupère la source de l'image par rapport à l'ID FR pour s'assurer de bien synchroniser les images dans les deux langues // Récupère la source de l'image par rapport à l'ID FR pour s'assurer de bien synchroniser les images dans les deux langues
$thematique_picture = get_field('taxonomy_pictures', "thematiques_" . $thematique_generale_id_fr)['illustration_s'] ?? null; $thematique_picture = get_field('taxonomy_pictures', "thematiques_" . $thematique_generale_id_fr)['illustration_s'] ?? null;
$lastUpdate = get_the_modified_date('', get_the_ID()); $lastUpdate = get_the_modified_date('', $args['ID']);
$args = array( $queryArgs = array(
// 'fields' => 'ids', // 'fields' => 'ids',
'post_type' => 'brochures', 'post_type' => 'brochures',
'posts_per_page' => 1, 'posts_per_page' => 1,
@ -21,10 +22,13 @@ $args = array(
) )
) )
); );
$relatedBrochuresPosts = get_posts($args);
$relatedBrochuresPosts = get_posts($queryArgs);
$relatedBrochure = get_field('brochure_pdf', $relatedBrochuresPosts[0]->ID) ?? null; $relatedBrochure = get_field('brochure_pdf', $relatedBrochuresPosts[0]->ID) ?? null;
?> ?>
@ -38,16 +42,18 @@ $relatedBrochure = get_field('brochure_pdf', $relatedBrochuresPosts[0]->ID) ?? n
<?php endif; ?> <?php endif; ?>
<h1 class="post-conseils-chapter-header__page-title"><?php echo get_the_title() ?></h1> <h1 class="post-conseils-chapter-header__page-title"><?php echo get_the_title($args['ID']) ?></h1>
<?php if ($relatedBrochure) : ?> <?php if ($relatedBrochure) : ?>
<a class="cta cta--primary cta--button" href="<?php echo $relatedBrochure['url'] ?>" target="_blank">Télécharger la brochure <?php echo $relatedBrochures[0]->post_title ?></a> <a class="cta cta--primary cta--button" href="<?php echo $relatedBrochure['url'] ?>" target="_blank">Télécharger la brochure <?php echo $relatedBrochures[0]->post_title ?></a>
<?php endif; ?> <?php endif; ?>
<?php if ($lastUpdate) : ?>
<time><?php echo __("Mis à jour le", "homegrade-theme__texte-fonctionnel") . " " . "$lastUpdate" ?></time>
<?php endif; ?>
<?php
get_template_part('template-components/post-infos-capsule', null, array(
"post_id" => $args['ID'],
"modified" => $lastUpdate
));
?>
</div> </div>
<img class="post-conseils-chapter-header__page-thematic-cover " src="<?php echo $thematique_picture['url'] ?>" alt=""> <img class="post-conseils-chapter-header__page-thematic-cover " src="<?php echo $thematique_picture['url'] ?>" alt="">