54 lines
2.1 KiB
PHP
54 lines
2.1 KiB
PHP
<?php
|
|
|
|
$thematique = get_the_terms($args->ID, 'thematiques')[0] ?? null;
|
|
$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');
|
|
|
|
|
|
// 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;
|
|
$lastUpdate = get_the_modified_date('', get_the_ID());
|
|
|
|
$args = array(
|
|
// 'fields' => 'ids',
|
|
'post_type' => 'brochures',
|
|
'posts_per_page' => 1,
|
|
'tax_query' => array(
|
|
array(
|
|
'taxonomy' => 'thematiques',
|
|
'field' => 'term_id',
|
|
'terms' => $thematique->term_id
|
|
)
|
|
)
|
|
);
|
|
$relatedBrochuresPosts = get_posts($args);
|
|
$relatedBrochure = get_field('brochure_pdf', $relatedBrochuresPosts[0]->ID) ?? null;
|
|
|
|
|
|
?>
|
|
|
|
|
|
<section class="post-conseils-chapter-header">
|
|
<div class="post-conseils-chapter-header__infos">
|
|
<?php if ($thematique->parent == 0) : ?>
|
|
|
|
<p class="post-conseils-chapter-header__page-thematic-title <?php echo "text-" . getThematiqueFamilySlug($thematique_generale->slug) ?>"><?php echo __("Les conseillers Homegrade vous guident", "homegrade-theme__bloks-texte-fonctionnel") ?></p>
|
|
<?php else : ?>
|
|
<p class="post-conseils-chapter-header__page-thematic-title <?php echo "text-" . getThematiqueFamilySlug($thematique_generale->slug) ?>"><?php echo $thematique_generale->name ?></p>
|
|
<?php endif; ?>
|
|
|
|
|
|
<h1 class="post-conseils-chapter-header__page-title"><?php echo get_the_title() ?></h1>
|
|
|
|
<?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>
|
|
<?php endif; ?>
|
|
<?php if ($lastUpdate) : ?>
|
|
<time>Dernière mise à jour : <?php echo $lastUpdate ?></time>
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
</div>
|
|
<img class="post-conseils-chapter-header__page-thematic-cover " src="<?php echo $thematique_picture['url'] ?>" alt="">
|
|
</section>
|