homegrade_theme_production/template-components/post-questions/chapter-header.php
2023-11-27 13:05:58 +01:00

47 lines
1.4 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']);
$queryArgs = array(
// 'fields' => 'ids',
'post_type' => 'brochures',
'posts_per_page' => 1,
'tax_query' => array(
array(
'taxonomy' => 'thematiques',
'field' => 'term_id',
'terms' => $thematique->term_id
)
)
);
?>
<section class="post-question-chapter-header">
<div class="post-question-chapter-header__infos">
<p class="post-question-chapter-header__page-thematic-title"><?php echo $thematique_generale->name ?></p>
<h1 class="post-question-chapter-header__page-title"><?php echo get_the_title($args['postID']) ?></h1>
<?php
get_template_part('template-components/post-infos-capsule', null, array(
"postID" => $args['postID'],
"modified" => $lastUpdate
));
?>
</div>
<img class="post-question-chapter-header__page-thematic-cover " src="<?php echo $thematique_picture['url'] ?>" alt="">
</section>