/** * HYBSTER FICHE TECHNIQUE V2 * Adapté aux vrais noms de champs ACF détectés via [hybster_debug_fields] * Champs présents : tensile_modulus_mpa, tensile_strength_mpa, tensile_elongation_pct, * charpy_notched_iso179_kj_m2, flexural_modulus_mpa, density_g_cm3, * matiere_famille_brut, applications_recommandees, renforce */ add_shortcode('hybster_fiche_technique', function() { if (get_post_type() !== 'matiere') return ''; $pid = get_the_ID(); // ── Lecture des champs PRÉSENTS dans ACF ───────────────────────────────────── $famille = get_field('matiere_famille_brut', $pid) ?: '—'; $renforce = get_field('renforce', $pid) ?: '—'; $filler = get_field('filler_reinforcement_raw', $pid) ?: '—'; $density = get_field('density_g_cm3', $pid) ?: 'N/A'; $tensile_mod = get_field('tensile_modulus_mpa', $pid) ?: 'N/A'; $tensile_str = get_field('tensile_strength_mpa', $pid) ?: 'N/A'; $tensile_elong = get_field('tensile_elongation_pct', $pid) ?: 'N/A'; $charpy = get_field('charpy_notched_iso179_kj_m2', $pid) ?: 'N/A'; $flex_mod = get_field('flexural_modulus_mpa', $pid) ?: 'N/A'; $flex_str = get_field('flexural_strength_mpa', $pid) ?: 'N/A'; $shore_a = get_field('durometer_shore_a', $pid) ?: '—'; $shore_d = get_field('durometer_shore_d', $pid) ?: '—'; $applications = get_field('applications_recommandees', $pid) ?: 'Consulter notre BE.'; $features = get_field('features', $pid) ?: '—'; $uses = get_field('uses', $pid) ?: '—'; // ── Lecture des champs À CRÉER (retour vide si absents) ────────────────────── $nom_commercial = get_field('nom_commercial', $pid) ?: get_the_title(); $sigle = get_field('sigle', $pid) ?: $famille; $process = get_field('process_compatibles', $pid) ?: '—'; $normes = get_field('normes_certifications', $pid) ?: '—'; $tg = get_field('tg', $pid); $hdt = get_field('hdt', $pid); $temp_min = get_field('temp_usage_min', $pid); $temp_max = get_field('temp_usage_max', $pid); $meca_note = get_field('mecanique_note', $pid) ?: 0; $therm_note = get_field('thermique_note', $pid) ?: 0; $chim_note = get_field('chimique_note', $pid) ?: 0; $uv_note = get_field('uv_note', $pid) ?: 0; $ul94 = get_field('ul94', $pid) ?: '—'; // ── Fonction helper : barre de score (note /5) ─────────────────────────────── $bar = function($note, $max = 5, $color = '#0055b1') { if (!$note) return 'Non renseigné'; $pct = ($note / $max) * 100; return '' . $note . '/' . $max . '
'; }; // ── Fonction helper : nettoyer les longues chaînes ACF ──────────────────────── // Les valeurs comme "1700 to 2830 (ASTM D638); 1730 to 2870 (ISO 527-1)" // → on affiche la première plage seulement en version courte $short = function($raw, $suffix = '') { if ($raw === 'N/A' || $raw === '—') return $raw; // Prendre uniquement la partie avant le premier " (" ou ";" $clean = preg_split('/\s*[\(;]/', $raw)[0]; return trim($clean) . ($suffix ? ' ' . $suffix : ''); }; // ── Construction HTML ───────────────────────────────────────────────────────── $h = '
'; // Badges dynamiques (champs à créer si absents) $h .= do_shortcode('[hybster_badges]'); // BLOC 1 : Identité $h .= '

Identité Matière

Nom Commercial' . esc_html($nom_commercial) . '
Famille' . esc_html($famille) . '
Densité' . esc_html($short($density, 'g/cm³')) . '
Renfort / Charge' . esc_html($filler !== '—' ? $filler : $renforce) . '
Process' . esc_html($process) . '
Normes / UL94' . esc_html($normes !== '—' ? $normes : $ul94) . '
'; // BLOC 2+3 : Mécanique + Thermique en flex $h .= '
'; // Mécanique $h .= '

Propriétés Mécaniques

Module traction' . esc_html($short($tensile_mod, 'MPa')) . '
Résistance traction' . esc_html($short($tensile_str, 'MPa')) . '
Allongement rupture' . esc_html($short($tensile_elong, '%')) . '
Module flexion' . esc_html($short($flex_mod, 'MPa')) . '
Résistance flexion' . esc_html($short($flex_str, 'MPa')) . '
Choc Charpy entaillé' . esc_html($short($charpy, 'kJ/m²')) . '
Dureté Shore A / D' . ($shore_a !== '—' ? 'A: '.esc_html($shore_a) : '') . ($shore_d !== '—' ? ' D: '.esc_html($shore_d) : '—') . '
Score global' . $bar($meca_note) . '
'; // Thermique $h .= '

Propriétés Thermiques

Tg' . ($tg ? esc_html($tg).' °C' : 'Champ à créer') . '
HDT (0.45 MPa)' . ($hdt ? esc_html($hdt).' °C' : 'Champ à créer') . '
T° usage' . ($temp_min && $temp_max ? esc_html($temp_min).' à '.esc_html($temp_max).' °C' : 'Champs à créer') . '
Score thermique' . $bar($therm_note, 5, '#dc3545') . '
'; $h .= '
'; // BLOC 4 : Chimie / UV $h .= '

Résistance Chimique & UV

Score chimique' . $bar($chim_note, 5, '#28a745') . '
Score UV' . $bar($uv_note, 5, '#fd7e14') . '

ℹ️ Renseignez les champs chimique_note et uv_note dans ACF pour activer ces barres.

'; // BLOC 5 : Applications $h .= '

Applications Recommandées

' . nl2br(esc_html($applications)) . '

'; // BLOC 6 : Radar $h .= '

Profil de Performance

' . do_shortcode('[hybster_radar_single]') . '
'; // BLOC 7 : CTA $slug = get_post_field('post_name'); $h .= '

Cette matière vous intéresse ?

Demander un devis + Comparer
'; // BLOC 8 : FAQ Schema $h .= '

Questions fréquentes

Quelles sont les applications principales ?

' . esc_html($applications) . '

Quelles sont les caractéristiques principales ?

' . ($features !== '—' ? esc_html($features) : 'Consulter notre bureau d\'études.') . '

'; $h .= '

* Données indicatives issues de bases normalisées (ASTM/ISO). Plages typiques pour un grade standard non renforcé.

'; $h .= '
'; return $h; }); Hybster | France https://validator.w3.org/feed/docs/rss2.html Articles Accueil Matières plastiques TS, Unspecified TSU TSU-Ether UHMWPE ULDPE Unspecified Urea Formald – cellulose Vinyl Ester ABS VLDPE XLPE TPE TPEA TPEE TPO – fibres de verre TPO – charge minérale + talc TPO – charge minérale TPO – talc TPO TPU Alloy TPU, Unspecified – fibres de verre TPU, Unspecified TPU-Capro TPU-Ester/Ether TPU-PC TPU-Polyester – fibres de verre TPU-Polyester TPU-Polyether TPV Alloy – Polypropylene TPV TS, Unspecified – fibres de verre SEBS SEEPS Silicone – fibres de verre Silicone – Unspecified Silicone Rubber, HTV Silicone Rubber, LSR – silice Silicone Rubber, LSR Silicone Rubber, RTV-1 Silicone Rubber, RTV-2 Silicone SIS SPS – fibres de verre TEEE TES TP, Unspecified – fibres de bois TP, Unspecified