handling manual link for brochure btn

This commit is contained in:
Antoine M 2023-11-29 20:21:34 +01:00
parent 257b8e89a1
commit 623f506265

View File

@ -107,12 +107,19 @@ if (!function_exists('build_share_urls')) {
$relatedBrochuresPosts = get_posts($queryArgs); $relatedBrochuresPosts = get_posts($queryArgs);
$relatedBrochure = get_field('brochure_pdf', $relatedBrochuresPosts[0]->ID) ?? null; $relatedBrochure = get_field('brochure_pdf', $relatedBrochuresPosts[0]->ID) ?? null;
$hasManualDocument = get_field('manual_source_document');
$manualSrcDocument = get_field('manual_document_link');
$relatedDocumentUrl = ($hasManualDocument && $manualSrcDocument && $manualSrcDocument['source_document']) ? $manualSrcDocument['source_document']['url'] : $relatedBrochure['url'];
$relatedDocumentCtaTitle = ($hasManualDocument && $manualSrcDocument && $manualSrcDocument['button_title']) ? $manualSrcDocument['button_title'] : __("Télécharger la brochure ", "homegrade-theme__texte-fonctionnel");
?> ?>
<?php get_template_part('template-components/post-conseils/chapter-header', null, array( <?php get_template_part('template-components/post-conseils/chapter-header', null, array(
'postID' => get_the_ID(), 'postID' => get_the_ID(),
'title' => get_the_title(get_the_ID()), 'title' => get_the_title(get_the_ID()),
'ctaUrl' => $relatedBrochure['url'], 'ctaUrl' => $relatedDocumentUrl,
'ctaTitle' => __("Télécharger la brochure ", "homegrade-theme__texte-fonctionnel"), 'ctaTitle' => $relatedDocumentCtaTitle,
'hasInfoCapsule' => true, 'hasInfoCapsule' => true,
)); ?> )); ?>
<div class=" conseils_wrapper"> <div class=" conseils_wrapper">