Images des annonces : seul le titre peut servir de légende

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.
This commit is contained in:
2026-10-13 18:55:44 +02:00
parent f5b75f05e4
commit 9fba350971
2 changed files with 6 additions and 8 deletions
-2
View File
@@ -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),
];
}
+6 -6
View File
@@ -51,7 +51,7 @@
<div class="swiper-slide">
<figure>
<img src="{{ img.url }}" alt="{{ img.alt }}" loading="lazy">
{% set legend = article.show_image_titles and img.title ? img.title : img.caption %}
{% set legend = article.show_image_titles ? img.title : '' %}
{% if legend %}
<figcaption>{{ legend }}</figcaption>
{% endif %}
@@ -67,7 +67,7 @@
{% for img in landscape_images %}
<figure>
<img src="{{ img.url }}" alt="{{ img.alt }}" loading="lazy">
{% set legend = article.show_image_titles and img.title ? img.title : img.caption %}
{% set legend = article.show_image_titles ? img.title : '' %}
{% if legend %}
<figcaption>{{ legend }}</figcaption>
{% endif %}
@@ -93,7 +93,7 @@
<div class="swiper-slide">
<figure class="sidebar-portrait">
<img src="{{ img.url }}" alt="{{ img.alt }}" loading="lazy">
{% set legend = article.show_image_titles and img.title ? img.title : img.caption %}
{% set legend = article.show_image_titles ? img.title : '' %}
{% if legend %}
<figcaption>{{ legend }}</figcaption>
{% endif %}
@@ -107,7 +107,7 @@
{% else %}
<figure class="sidebar-portrait">
<img src="{{ portrait_images[0].url }}" alt="{{ portrait_images[0].alt }}" loading="lazy">
{% set legend = article.show_image_titles and portrait_images[0].title ? portrait_images[0].title : portrait_images[0].caption %}
{% set legend = article.show_image_titles ? portrait_images[0].title : '' %}
{% if legend %}
<figcaption>{{ legend }}</figcaption>
{% endif %}
@@ -353,7 +353,7 @@
{% for img in s.images %}
<figure>
<img src="{{ img.url }}" alt="{{ img.alt }}" loading="lazy">
{% set legend = s.show_image_titles and img.title ? img.title : img.caption %}
{% set legend = s.show_image_titles ? img.title : '' %}
{% if legend %}
<figcaption>{{ legend }}</figcaption>
{% endif %}
@@ -444,7 +444,7 @@
{% for img in s.images %}
<figure>
<img src="{{ img.url }}" alt="{{ img.alt }}" loading="lazy">
{% set legend = s.show_image_titles and img.title ? img.title : img.caption %}
{% set legend = s.show_image_titles ? img.title : '' %}
{% if legend %}
<figcaption>{{ legend }}</figcaption>
{% endif %}