homegrade_theme_production/template-components/post-conseils/chapter-header.php

44 lines
1.6 KiB
PHP

<?php
$thematique = get_the_terms($args['postID'], '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('', $args['postID']);
?>
<section class="post-conseils-chapter-header">
<div class="post-conseils-chapter-header__infos">
<p class="post-conseils-chapter-header__page-thematic-title"><?php echo __("Les conseillers Homegrade vous guident", "homegrade-theme__texte-fonctionnel") ?></p>
<h1 class="post-conseils-chapter-header__page-title"><?php echo $args['title'] ?></h1>
<?php if ($args['ctaUrl']) : ?>
<a class="cta cta--primary cta--button" href="<?php echo $args['ctaUrl'] ?>" target="<?php echo $args['ctaTarget'] ?? "_blank" ?>">
<?php
echo $args['ctaTitle'];
?><span class="sr-only"><?php echo $relatedBrochure['title'] ?></span> </a>
<?php endif; ?>
<?php if ($args['hasInfoCapsule']) : ?>
<?php
get_template_part('template-components/post-infos-capsule', null, array(
"postID" => $args['postID'],
"modified" => $lastUpdate
));
?>
<?php endif ?>
</div>
<img class="post-conseils-chapter-header__page-thematic-cover " src="<?php echo $thematique_picture['url'] ?>" alt="">
</section>