Corrections Pods (sous-types custom-simple, sync pick→taxonomie), agenda accueil et gras/italique single
This commit is contained in:
@@ -2134,12 +2134,12 @@ footer {
|
|||||||
.article .main-content-text p {
|
.article .main-content-text p {
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
line-height: 1.4; }
|
line-height: 1.4; }
|
||||||
.article .main-content-text p strong {
|
|
||||||
font-weight: bold; }
|
|
||||||
.article .main-content-text p em {
|
|
||||||
font-style: italic; }
|
|
||||||
.article .main-content-text p:first-child {
|
.article .main-content-text p:first-child {
|
||||||
margin-top: 0 !important; }
|
margin-top: 0 !important; }
|
||||||
|
.article .main-content-text strong, .article .main-content-text b {
|
||||||
|
font-weight: bold; }
|
||||||
|
.article .main-content-text em, .article .main-content-text i {
|
||||||
|
font-style: italic; }
|
||||||
.article .main-content-text ul, .article .main-content-text ol {
|
.article .main-content-text ul, .article .main-content-text ol {
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
padding-left: 0.8rem; }
|
padding-left: 0.8rem; }
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ require_once __DIR__ . '/inc/admin-tweaks.php';
|
|||||||
require_once __DIR__ . '/inc/admin-users-filter.php';
|
require_once __DIR__ . '/inc/admin-users-filter.php';
|
||||||
// Patchs Pods : validation conditionnelle requise, erreurs de sauvegarde
|
// Patchs Pods : validation conditionnelle requise, erreurs de sauvegarde
|
||||||
require_once __DIR__ . '/inc/pods-conditional-required.php';
|
require_once __DIR__ . '/inc/pods-conditional-required.php';
|
||||||
|
require_once __DIR__ . '/inc/pods-custom-simple-decode.php';
|
||||||
|
require_once __DIR__ . '/inc/pods-taxonomy-sync.php';
|
||||||
require_once __DIR__ . '/inc/pods-save-error-handler.php';
|
require_once __DIR__ . '/inc/pods-save-error-handler.php';
|
||||||
require_once __DIR__ . '/inc/post-title-required.php';
|
require_once __DIR__ . '/inc/post-title-required.php';
|
||||||
// Helpers partagés des pages d'archives (filtres GET, rubriques, « Autres »)
|
// Helpers partagés des pages d'archives (filtres GET, rubriques, « Autres »)
|
||||||
|
|||||||
107
inc/pods-custom-simple-decode.php
Normal file
107
inc/pods-custom-simple-decode.php
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Corrige la sauvegarde des champs pick « custom-simple » dont une option
|
||||||
|
* contient un caractère spécial HTML (', ", &, <, >).
|
||||||
|
*
|
||||||
|
* Symptôme : sélectionner « Journée d'étude » dans le menu `type_*` puis
|
||||||
|
* enregistrer ne sauvegarde rien — le champ reste vide.
|
||||||
|
*
|
||||||
|
* Cause : le front-end Pods (DFV/React) encode la *valeur* des options avec
|
||||||
|
* htmlspecialchars (ex. « Journée d'étude » → « Journée d'étude »), alors
|
||||||
|
* que la liste des valeurs valides (`pick_custom`) contient l'apostrophe brute.
|
||||||
|
* À la sauvegarde, PodsAPI::save_pod_item compare la valeur reçue aux options
|
||||||
|
* autorisées (isset($custom_values[$v])) : « Journée d'étude » ne matche
|
||||||
|
* aucune clé → la valeur est rejetée, et PodsMeta l'écrit vide.
|
||||||
|
*
|
||||||
|
* Correctif : on rejoue l'inverse de l'encodage (html_entity_decode) sur la
|
||||||
|
* valeur des champs pick custom-simple dans `pods_api_pre_save_pod_item_post`,
|
||||||
|
* qui s'exécute *avant* la validation des options. « Journée d'étude »
|
||||||
|
* redevient « Journée d'étude » et matche l'option. Sans effet sur les valeurs
|
||||||
|
* sans caractère spécial (décodage no-op) ni sur les données existantes.
|
||||||
|
*/
|
||||||
|
add_filter( 'pods_api_pre_save_pod_item_post', 'thalim_decode_custom_simple_entities', 10, 3 );
|
||||||
|
|
||||||
|
function thalim_decode_custom_simple_entities( $pieces, $is_new_item, $id ) {
|
||||||
|
if ( empty( $pieces['fields'] ) ) {
|
||||||
|
return $pieces;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ( $pieces['fields'] as $name => $field_data ) {
|
||||||
|
// Ne cibler que les pick « custom-simple » (options en dur via pick_custom).
|
||||||
|
if ( 'pick' !== pods_v( 'type', $field_data ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( 'custom-simple' !== pods_v( 'pick_object', $field_data ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$value = isset( $field_data['value'] ) ? $field_data['value'] : null;
|
||||||
|
if ( null === $value || '' === $value ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$decoded = thalim_html_entity_decode_deep( $value );
|
||||||
|
if ( $decoded !== $value ) {
|
||||||
|
$pieces['fields'][ $name ]['value'] = $decoded;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $pieces;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pendant côté AFFICHAGE du même bug d'encodage.
|
||||||
|
*
|
||||||
|
* Symptôme : après avoir enregistré « Journée d'étude », le menu de la page
|
||||||
|
* d'édition ré-affiche « -- Sélectionnez -- » alors que la valeur est bien
|
||||||
|
* stockée (la pastille s'affiche sur le post).
|
||||||
|
*
|
||||||
|
* Cause : Pods construit la *valeur* (`id`) de chaque option DFV via
|
||||||
|
* html_entity_decode( esc_html( $id ), ENT_COMPAT ) (PodsField_Pick::
|
||||||
|
* build_dfv_field_item_data_recurse_item). esc_html encode l'apostrophe en
|
||||||
|
* ', mais ENT_COMPAT NE décode PAS les apostrophes → l'option garde la
|
||||||
|
* value « Journée d'étude », qui ne correspond pas à la valeur stockée
|
||||||
|
* brute « Journée d'étude » → le <select> React retombe sur le placeholder.
|
||||||
|
*
|
||||||
|
* Correctif : on redécode les entités des `id` d'options des pick custom-simple
|
||||||
|
* via le filtre `pods_field_dfv_data` (qui reçoit toute la config DFV). La value
|
||||||
|
* de l'option redevient brute et matche la valeur stockée → l'option s'affiche
|
||||||
|
* sélectionnée. Bonus : le DFV soumettra alors la value brute au save.
|
||||||
|
*/
|
||||||
|
add_filter( 'pods_field_dfv_data', 'thalim_decode_custom_simple_dfv_ids', 10, 3 );
|
||||||
|
|
||||||
|
function thalim_decode_custom_simple_dfv_ids( $data, $args, $attributes ) {
|
||||||
|
// $args->options peut être un array OU un objet Field (ArrayAccess) ; pods_v gère les deux.
|
||||||
|
$type = isset( $args->type ) ? $args->type : '';
|
||||||
|
$options = isset( $args->options ) ? $args->options : [];
|
||||||
|
$pick_object = pods_v( 'pick_object', $options );
|
||||||
|
|
||||||
|
if ( 'pick' !== $type || 'custom-simple' !== $pick_object ) {
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
if ( empty( $data['fieldItemData'] ) || ! is_array( $data['fieldItemData'] ) ) {
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ( $data['fieldItemData'] as $i => $item ) {
|
||||||
|
if ( is_array( $item ) && isset( $item['id'] ) && is_string( $item['id'] ) ) {
|
||||||
|
$data['fieldItemData'][ $i ]['id'] = html_entity_decode( $item['id'], ENT_QUOTES | ENT_HTML5, 'UTF-8' );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* html_entity_decode récursif (gère string et tableau de strings — un pick
|
||||||
|
* multi-valeur soumet un tableau). ENT_QUOTES pour couvrir ' / ".
|
||||||
|
*/
|
||||||
|
function thalim_html_entity_decode_deep( $value ) {
|
||||||
|
if ( is_array( $value ) ) {
|
||||||
|
return array_map( 'thalim_html_entity_decode_deep', $value );
|
||||||
|
}
|
||||||
|
if ( is_string( $value ) ) {
|
||||||
|
return html_entity_decode( $value, ENT_QUOTES | ENT_HTML5, 'UTF-8' );
|
||||||
|
}
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
75
inc/pods-taxonomy-sync.php
Normal file
75
inc/pods-taxonomy-sync.php
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Synchronise les champs pick → taxonomie du pod `post` vers les vraies
|
||||||
|
* relations de termes WordPress (wp_term_relationships) après chaque save.
|
||||||
|
*
|
||||||
|
* Problème : `programmes_de_recherche`, `etiquettes` et `axes_thematiques` sont
|
||||||
|
* des champs pick `pick_object = taxonomy` configurés avec `pick_sync_taxonomy = 0`.
|
||||||
|
* Quand on les édite dans l'admin, Pods stocke la relation dans SES tables
|
||||||
|
* (postmeta + wp_podsrel) mais NE crée PAS l'assignation de terme WordPress.
|
||||||
|
* Or les pages d'archive de ces taxonomies (`taxonomy.php`, `tag.php`) et le
|
||||||
|
* nuage de mots-clés interrogent la vraie taxonomie via tax_query / get_terms :
|
||||||
|
* un post assigné uniquement via le champ Pods n'y apparaît pas.
|
||||||
|
* (Le champ `categorie` n'est PAS concerné : lui a `pick_sync_taxonomy = 1`.)
|
||||||
|
*
|
||||||
|
* L'importeur HAL, lui, écrit déjà le terme natif (wp_set_object_terms) ; le
|
||||||
|
* trou est côté sauvegarde admin. Ce hook comble ce trou pour toutes les
|
||||||
|
* origines de save.
|
||||||
|
*
|
||||||
|
* Stratégie : APPEND-ONLY. On n'ajoute que les termes présents dans le champ
|
||||||
|
* Pods mais absents de la taxonomie native. On ne retire jamais de terme —
|
||||||
|
* ainsi aucun risque de détruire des assignations posées par ailleurs (ex.
|
||||||
|
* post_tag issus du matching HAL). La contrepartie (un terme retiré du champ
|
||||||
|
* Pods reste en taxonomie native) est un moindre mal, très rare ici.
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Champs pick→taxonomie du pod `post` à synchroniser (clé meta => taxonomy WP).
|
||||||
|
* `categorie` est volontairement absent (déjà synchronisé par Pods).
|
||||||
|
*/
|
||||||
|
function thalim_pod_tax_sync_fields(): array {
|
||||||
|
return [
|
||||||
|
'programmes_de_recherche' => 'programme_de_recherche',
|
||||||
|
'etiquettes' => 'post_tag',
|
||||||
|
'axes_thematiques' => 'axe_thematique',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
add_action( 'save_post', 'thalim_sync_pods_taxonomy_relations', 99, 2 );
|
||||||
|
|
||||||
|
function thalim_sync_pods_taxonomy_relations( $post_id, $post ) {
|
||||||
|
if ( ! ( $post instanceof WP_Post ) || 'post' !== $post->post_type ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ( wp_is_post_revision( $post_id ) || wp_is_post_autosave( $post_id ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ( thalim_pod_tax_sync_fields() as $field => $taxonomy ) {
|
||||||
|
if ( ! taxonomy_exists( $taxonomy ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Valeurs du champ Pods (source de vérité) : une ligne postmeta par term_id.
|
||||||
|
$ids = array_values( array_unique( array_filter(
|
||||||
|
array_map( 'intval', (array) get_post_meta( $post_id, $field ) )
|
||||||
|
) ) );
|
||||||
|
if ( empty( $ids ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Termes déjà assignés en taxonomie native.
|
||||||
|
$current = wp_get_object_terms( $post_id, $taxonomy, [ 'fields' => 'ids' ] );
|
||||||
|
$current = is_wp_error( $current ) ? [] : array_map( 'intval', $current );
|
||||||
|
|
||||||
|
// N'ajouter que les manquants (append), ne jamais retirer.
|
||||||
|
$missing = array_diff( $ids, $current );
|
||||||
|
if ( ! empty( $missing ) ) {
|
||||||
|
wp_set_object_terms( $post_id, array_values( $missing ), $taxonomy, true );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
93
index.php
93
index.php
@@ -88,7 +88,7 @@ $messages_labo = Timber::get_posts([
|
|||||||
$context['messages_labo'] = $messages_labo ?: [];
|
$context['messages_labo'] = $messages_labo ?: [];
|
||||||
$context['message_labo_link'] = thalim_en_url( get_category_link( thalim_cat_id('message-labo') ) );
|
$context['message_labo_link'] = thalim_en_url( get_category_link( thalim_cat_id('message-labo') ) );
|
||||||
|
|
||||||
// --- Agenda (médiation scientifique + séances de séminaire à venir) ---
|
// --- Agenda (manifestations scientifiques + séances de séminaire + médiation à venir) ---
|
||||||
$agenda_lang = thalim_current_language();
|
$agenda_lang = thalim_current_language();
|
||||||
// Catégories « agenda » résolues par slug (médiation + newsletter/gazette historiques)
|
// Catégories « agenda » résolues par slug (médiation + newsletter/gazette historiques)
|
||||||
$mediation_cat_ids = array_values( array_filter( [
|
$mediation_cat_ids = array_values( array_filter( [
|
||||||
@@ -107,6 +107,30 @@ $agenda_type_fields = [
|
|||||||
'type_media', 'type_captation', 'type_revue_collection', 'type_autre',
|
'type_media', 'type_captation', 'type_revue_collection', 'type_autre',
|
||||||
];
|
];
|
||||||
$now_str = date('Y-m-d H:i:s');
|
$now_str = date('Y-m-d H:i:s');
|
||||||
|
$today = date('Y-m-d');
|
||||||
|
|
||||||
|
// Date d'événement d'un post : date_de_debut prioritaire, datetime (communications) en secours.
|
||||||
|
$read_event_date = function ($post_id) {
|
||||||
|
foreach (['date_de_debut', 'datetime'] as $key) {
|
||||||
|
$val = get_post_meta($post_id, $key, true);
|
||||||
|
if ($val && strpos($val, '0000-00-00') !== 0) return $val;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
};
|
||||||
|
|
||||||
|
// type_label : premier champ type_* rempli, sinon nom d'une catégorie du post présente dans $cat_ids.
|
||||||
|
$agenda_type_label = function ($post_id, array $cat_ids = []) use ($agenda_type_fields) {
|
||||||
|
foreach ($agenda_type_fields as $field) {
|
||||||
|
$val = get_post_meta($post_id, $field, true);
|
||||||
|
if ($val) return $val;
|
||||||
|
}
|
||||||
|
if ($cat_ids) {
|
||||||
|
foreach (get_the_category($post_id) as $cat) {
|
||||||
|
if (in_array($cat->term_id, $cat_ids)) return thalim_cat_name($cat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
};
|
||||||
|
|
||||||
$make_agenda_item = function ($post, $raw_date, $type_label, $lieu, $link) use ($agenda_lang, $months_fr, $months_en) {
|
$make_agenda_item = function ($post, $raw_date, $type_label, $lieu, $link) use ($agenda_lang, $months_fr, $months_en) {
|
||||||
$ts = strtotime($raw_date);
|
$ts = strtotime($raw_date);
|
||||||
@@ -124,6 +148,7 @@ $make_agenda_item = function ($post, $raw_date, $type_label, $lieu, $link) use (
|
|||||||
};
|
};
|
||||||
|
|
||||||
$agenda_items = [];
|
$agenda_items = [];
|
||||||
|
$seen_ids = [];
|
||||||
|
|
||||||
// 1. Upcoming médiation scientifique posts
|
// 1. Upcoming médiation scientifique posts
|
||||||
$mediation_upcoming = Timber::get_posts([
|
$mediation_upcoming = Timber::get_posts([
|
||||||
@@ -141,23 +166,51 @@ $mediation_upcoming = Timber::get_posts([
|
|||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
foreach ($mediation_upcoming as $mpost) {
|
foreach ($mediation_upcoming as $mpost) {
|
||||||
|
if (isset($seen_ids[$mpost->ID])) continue;
|
||||||
$raw_date = get_post_meta($mpost->ID, 'date_de_debut', true);
|
$raw_date = get_post_meta($mpost->ID, 'date_de_debut', true);
|
||||||
if (!$raw_date) continue;
|
if (!$raw_date) continue;
|
||||||
$type_label = '';
|
$type_label = $agenda_type_label($mpost->ID, $mediation_cat_ids);
|
||||||
foreach ($agenda_type_fields as $field) {
|
|
||||||
$val = get_post_meta($mpost->ID, $field, true);
|
|
||||||
if ($val) { $type_label = $val; break; }
|
|
||||||
}
|
|
||||||
if (!$type_label) {
|
|
||||||
foreach (get_the_category($mpost->ID) as $cat) {
|
|
||||||
if (in_array($cat->term_id, $mediation_cat_ids)) { $type_label = thalim_cat_name($cat); break; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$item = $make_agenda_item($mpost, $raw_date, $type_label, get_post_meta($mpost->ID, 'lieu', true) ?: '', get_permalink($mpost->ID));
|
$item = $make_agenda_item($mpost, $raw_date, $type_label, get_post_meta($mpost->ID, 'lieu', true) ?: '', get_permalink($mpost->ID));
|
||||||
if ($item) $agenda_items[] = $item;
|
if ($item) { $agenda_items[] = $item; $seen_ids[$mpost->ID] = true; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Upcoming séances de séminaire
|
// 2. Upcoming manifestations scientifiques (colloques, journées d'études, communications,
|
||||||
|
// soutenances…) — tout le sous-arbre « manifestations » SAUF les séminaires (on affiche
|
||||||
|
// leurs séances, cf. bloc 3). date_de_debut ou datetime (communications) via event-date filter.
|
||||||
|
$manif_exclude = array_values( array_filter( [ thalim_cat_id('seminaires'), thalim_cat_id('seance') ] ) );
|
||||||
|
$manif_upcoming = Timber::get_posts([
|
||||||
|
'post_type' => 'post',
|
||||||
|
'posts_per_page' => -1,
|
||||||
|
'tax_query' => [
|
||||||
|
'relation' => 'AND',
|
||||||
|
[
|
||||||
|
'taxonomy' => 'category',
|
||||||
|
'field' => 'term_id',
|
||||||
|
'terms' => [ thalim_cat_id('manifestations') ],
|
||||||
|
'include_children' => true,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'taxonomy' => 'category',
|
||||||
|
'field' => 'term_id',
|
||||||
|
'terms' => $manif_exclude,
|
||||||
|
'operator' => 'NOT IN',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'thalim_event_date_filter' => [ 'from' => $today ],
|
||||||
|
]);
|
||||||
|
$manif_label_cats = array_values( array_filter( [
|
||||||
|
thalim_cat_id('colloques'), thalim_cat_id('communications'), thalim_cat_id('soutenances'),
|
||||||
|
] ) );
|
||||||
|
foreach ($manif_upcoming as $mpost) {
|
||||||
|
if (isset($seen_ids[$mpost->ID])) continue;
|
||||||
|
$raw_date = $read_event_date($mpost->ID);
|
||||||
|
if (!$raw_date) continue;
|
||||||
|
$type_label = $agenda_type_label($mpost->ID, $manif_label_cats);
|
||||||
|
$item = $make_agenda_item($mpost, $raw_date, $type_label, get_post_meta($mpost->ID, 'lieu', true) ?: '', get_permalink($mpost->ID));
|
||||||
|
if ($item) { $agenda_items[] = $item; $seen_ids[$mpost->ID] = true; }
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Upcoming séances de séminaire
|
||||||
$seances_upcoming = Timber::get_posts([
|
$seances_upcoming = Timber::get_posts([
|
||||||
'post_type' => 'post',
|
'post_type' => 'post',
|
||||||
'posts_per_page' => 8,
|
'posts_per_page' => 8,
|
||||||
@@ -173,12 +226,13 @@ $seances_upcoming = Timber::get_posts([
|
|||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
foreach ($seances_upcoming as $seance) {
|
foreach ($seances_upcoming as $seance) {
|
||||||
|
if (isset($seen_ids[$seance->ID])) continue;
|
||||||
$raw_date = get_post_meta($seance->ID, 'date_de_debut', true);
|
$raw_date = get_post_meta($seance->ID, 'date_de_debut', true);
|
||||||
if (!$raw_date) continue;
|
if (!$raw_date) continue;
|
||||||
$link = thalim_get_seance_link($seance->ID);
|
$link = thalim_get_seance_link($seance->ID);
|
||||||
$label = $agenda_lang === 'en' ? 'Seminar session' : 'Séance de séminaire';
|
$label = $agenda_lang === 'en' ? 'Seminar session' : 'Séance de séminaire';
|
||||||
$item = $make_agenda_item($seance, $raw_date, $label, get_post_meta($seance->ID, 'lieu', true) ?: '', $link);
|
$item = $make_agenda_item($seance, $raw_date, $label, get_post_meta($seance->ID, 'lieu', true) ?: '', $link);
|
||||||
if ($item) $agenda_items[] = $item;
|
if ($item) { $agenda_items[] = $item; $seen_ids[$seance->ID] = true; }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sort merged list by date, keep 5 soonest
|
// Sort merged list by date, keep 5 soonest
|
||||||
@@ -199,16 +253,7 @@ if (empty($agenda_items)) {
|
|||||||
foreach ($fallback as $fpost) {
|
foreach ($fallback as $fpost) {
|
||||||
$raw_date = get_post_meta($fpost->ID, 'date_de_debut', true);
|
$raw_date = get_post_meta($fpost->ID, 'date_de_debut', true);
|
||||||
if (!$raw_date) continue;
|
if (!$raw_date) continue;
|
||||||
$type_label = '';
|
$type_label = $agenda_type_label($fpost->ID, $mediation_cat_ids);
|
||||||
foreach ($agenda_type_fields as $field) {
|
|
||||||
$val = get_post_meta($fpost->ID, $field, true);
|
|
||||||
if ($val) { $type_label = $val; break; }
|
|
||||||
}
|
|
||||||
if (!$type_label) {
|
|
||||||
foreach (get_the_category($fpost->ID) as $cat) {
|
|
||||||
if (in_array($cat->term_id, $mediation_cat_ids)) { $type_label = thalim_cat_name($cat); break; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$item = $make_agenda_item($fpost, $raw_date, $type_label, get_post_meta($fpost->ID, 'lieu', true) ?: '', get_permalink($fpost->ID));
|
$item = $make_agenda_item($fpost, $raw_date, $type_label, get_post_meta($fpost->ID, 'lieu', true) ?: '', get_permalink($fpost->ID));
|
||||||
if ($item) $agenda_items[] = $item;
|
if ($item) $agenda_items[] = $item;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,11 @@ document.addEventListener('DOMContentLoaded', function () {
|
|||||||
var budget = agendaContent.offsetHeight
|
var budget = agendaContent.offsetHeight
|
||||||
- (sectionTitle ? sectionTitle.offsetHeight : 0)
|
- (sectionTitle ? sectionTitle.offsetHeight : 0)
|
||||||
- (buttonMessages ? buttonMessages.offsetHeight : 0);
|
- (buttonMessages ? buttonMessages.offsetHeight : 0);
|
||||||
|
// Plancher : au moins un premier message complet, même quand l'agenda est court
|
||||||
|
// (peu d'événements à venir → sinon le calcul de budget masquerait tous les messages).
|
||||||
|
if (items.length) {
|
||||||
|
budget = Math.max(budget, items[0].offsetHeight);
|
||||||
|
}
|
||||||
var used = 0;
|
var used = 0;
|
||||||
|
|
||||||
for (var i = 0; i < items.length; i++) {
|
for (var i = 0; i < items.length; i++) {
|
||||||
|
|||||||
@@ -279,17 +279,21 @@
|
|||||||
p {
|
p {
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
strong {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
em {
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
&:first-child {
|
&:first-child {
|
||||||
margin-top: 0 !important;
|
margin-top: 0 !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Le reset applique `font: inherit` à strong/b/em/i : on restaure gras et
|
||||||
|
// italique pour tout le corps de texte (paragraphes, listes, citations…),
|
||||||
|
// pas seulement sous <p>, sinon le formatage disparaît dans les <li>.
|
||||||
|
strong, b {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
em, i {
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
|
||||||
ul, ol {
|
ul, ol {
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
padding-left: 0.8rem;
|
padding-left: 0.8rem;
|
||||||
|
|||||||
Reference in New Issue
Block a user