From 9fba350971b7244475172c049f3ece90d3252037 Mon Sep 17 00:00:00 2001 From: Valentin Le Moign Date: Tue, 13 Oct 2026 18:55:44 +0200 Subject: [PATCH] =?UTF-8?q?Images=20des=20annonces=20:=20seul=20le=20titre?= =?UTF-8?q?=20peut=20servir=20de=20l=C3=A9gende?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Les légendes des médias ne sont plus jamais affichées sous les images des annonces et des séances. Le titre de l'image s'affiche uniquement quand « Afficher le titre des images en légende » est cochée ; sinon, aucune légende. WordPress remplit automatiquement la légende à l'upload à partir des métadonnées EXIF/IPTC du fichier (ex. « Screenshot » pour les captures macOS), ce qui faisait apparaître un texte malgré la case décochée. --- inc/single-helpers.php | 2 -- templates/single.twig | 12 ++++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/inc/single-helpers.php b/inc/single-helpers.php index 5273eb4..27a81b5 100644 --- a/inc/single-helpers.php +++ b/inc/single-helpers.php @@ -189,7 +189,6 @@ function thalim_get_single_data($post_id) { $data['images'][] = [ 'url' => $src, 'alt' => get_post_meta($doc_id, '_wp_attachment_image_alt', true) ?: '', - 'caption' => thalim_bilingual(wp_get_attachment_caption($doc_id) ?: '', $lang), 'title' => thalim_bilingual(get_the_title($doc_id) ?: '', $lang), 'portrait' => thalim_image_is_portrait($doc_id, $w, $h), ]; @@ -351,7 +350,6 @@ function thalim_get_single_data($post_id) { $seance_data['images'][] = [ 'url' => $src, 'alt' => get_post_meta($doc_id, '_wp_attachment_image_alt', true) ?: '', - 'caption' => thalim_bilingual(wp_get_attachment_caption($doc_id) ?: '', $lang), 'title' => thalim_bilingual(get_the_title($doc_id) ?: '', $lang), ]; } diff --git a/templates/single.twig b/templates/single.twig index 237d375..37d384e 100644 --- a/templates/single.twig +++ b/templates/single.twig @@ -51,7 +51,7 @@
{{ img.alt }} - {% set legend = article.show_image_titles and img.title ? img.title : img.caption %} + {% set legend = article.show_image_titles ? img.title : '' %} {% if legend %}
{{ legend }}
{% endif %} @@ -67,7 +67,7 @@ {% for img in landscape_images %}
{{ img.alt }} - {% set legend = article.show_image_titles and img.title ? img.title : img.caption %} + {% set legend = article.show_image_titles ? img.title : '' %} {% if legend %}
{{ legend }}
{% endif %} @@ -93,7 +93,7 @@