diff --git a/single-conseils.php b/single-conseils.php index 10e026f..7565950 100644 --- a/single-conseils.php +++ b/single-conseils.php @@ -80,9 +80,27 @@ if (!function_exists('build_share_urls')) { post_content); $chapterBlockIndex = build_chapter_index($blocks); + $queryArgs = array( + 'post_type' => 'brochures', + 'posts_per_page' => 1, + 'tax_query' => array( + array( + 'taxonomy' => 'thematiques', + 'field' => 'term_id', + 'terms' => $currentThematique->term_id + ) + ) + ); + $relatedBrochuresPosts = get_posts($queryArgs); + $relatedBrochure = get_field('brochure_pdf', $relatedBrochuresPosts[0]->ID) ?? null; + ?> get_the_ID(), + 'title' => get_the_title(get_the_ID()), + 'ctaUrl' => $relatedBrochure['url'], + 'ctaTitle' => __("Télécharger la brochure ", "homegrade-theme__texte-fonctionnel"), + 'hasInfoCapsule' => true, )); ?>