Dynamic job profiles (WordPress).
WordPress template that generates 50+ FR/EN job profiles from structured JSON, with robust rendering on variable content.
wordpressphpjsonhtmlcss

Challenges
- 01.Industrialize the generation of 50+ profiles from heterogeneous structures
- 02.Handle multilingual (FR/EN) and consistent slugs / URLs
- 03.Guarantee clean rendering even when some sections are missing (incomplete data)
- 04.Keep editing maintainable: content in the JSON, display in the template
Solutions
- 01.PHP template split into blocks (missions, skills, training, CTA, etc.) fed by JSON
- 02.Fallback system: section hidden if empty, default values, centralized labels (common.json)
- 03.FR/EN slug mapping for stable URLs and consistent translation links
- 04.Shared content (e.g. contacts) referenced by ID to avoid duplication
JSON loading + conditional rendering (no ACF)php
1// Déterminer la langue (ex : via WPML/Polylang ou une règle maison)2 $lang = function_exists('pll_current_language') ? pll_current_language('slug') : 'fr';34 // Exemple : URL -> .../marketing-communication/analyste-cybersecurite/5 // $category_slug et $job_slug proviennent du routage/template6 $category_slug = get_query_var('category_slug');7 $job_slug = get_query_var('job_slug');89 // Charger le JSON de la catégorie (fr/categories/<slug>.json)10 $json_path = get_stylesheet_directory() . "/fiches-metiers/{$lang}/categories/{$category_slug}.json";11 $items = file_exists($json_path) ? json_decode(file_get_contents($json_path), true) : [];1213 // Retrouver la fiche par slug14 $job = null;15 foreach ($items as $item) {16 if (($item['slug'] ?? '') === $job_slug) {17 $job = $item;18 break;19 }20 }21 if (!$job) {22 // 404 si fiche introuvable23 status_header(404);24 nocache_headers();25 include get_404_template();26 exit;27 }2829 // Exemple : rendre une section uniquement si la donnée existe30 $skills = $job['competences_block']['items'] ?? [];31 if (!empty($skills)) : ?>32 <section class="job-section">33 <h2>Compétences clés</h2>34 <ul>35 <?php foreach ($skills as $skill) : ?>36 <li><?php echo esc_html($skill); ?></li>37 <?php endforeach; ?>38 </ul>39 </section>40 <?php endif; ?>
→ NextOther projects