FEATURE HAndling analyses-etudes extyernal link exception

This commit is contained in:
Antoine M 2026-05-13 11:53:56 +02:00
parent 4cdc50ed5d
commit f0a5c07d0a

View File

@ -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;
}
}
}
?>
<a class="post-card post-card--<?php echo $current_post_type . ' ' . ($has_post_thumbnail ? 'post-card--has-thumbnail' : ''); ?> card" href="<?php echo esc_url($link); ?>" target="<?php echo $target; ?>">