From f0a5c07d0adf442751db3e944756630121fc1c8d Mon Sep 17 00:00:00 2001 From: Antoine M Date: Wed, 13 May 2026 11:53:56 +0200 Subject: [PATCH] FEATURE HAndling analyses-etudes extyernal link exception --- template-parts/components/cards/post-card.php | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/template-parts/components/cards/post-card.php b/template-parts/components/cards/post-card.php index 49676db..3159511 100644 --- a/template-parts/components/cards/post-card.php +++ b/template-parts/components/cards/post-card.php @@ -36,6 +36,28 @@ $description = get_field('description', $ID); $birth_death_date = get_field('birth_death_date', $ID); +if($current_post_type === 'analyses-etudes'){ + $type_analyse_etude = get_the_terms($ID, 'type-analyse-etude')[0] ?? null; + + if($type_analyse_etude->slug === 'analyse'){ + $link_type = get_field('link_type', $ID); + $target = '_blank' ; + + switch($link_type){ + case 'pdf': + $link = get_field('pdf', $ID)['url'] ?? ''; + break; + case 'link': + $link = get_field('link', $ID)['url'] ?? ''; + break; + default: + $link = get_the_permalink($ID); + break; + } + } +} + + ?>