post_name . '.twig', 'page.twig' ), $context ); $parent = get_post($timber_post->post_parent); // Verificar si es una subpágina de servicios $cast_subpagina_servicios = ($parent && ($parent->post_name === 'servicios-privados' || $parent->post_name === 'servicios-publicos')); $eusk_subpagina_zerbitzu = ($parent && ($parent->post_name === 'zerbitzu-pribatuak' || $parent->post_name === 'zerbitzu-publikoak')); $subpagina_industria = ($parent && ($parent->post_name === 'industria')); $slug_actual = $timber_post->post_name; //error_log('✅ (page.php) Slug actual: ' . $slug_actual); $pagina_servicios = ($slug_actual === 'servicios-privados' || $slug_actual === 'servicios-publicos' || $slug_actual === 'zerbitzu-pribatuak' || $slug_actual === 'zerbitzu-publikoak'); if ($parent && ($parent->post_name === 'contactos' || $parent->post_name === 'kontaktua') ) { // subpáginas de contactos Timber::render('templates/page-contactos.twig', $context); } elseif ($pagina_servicios) { error_log('✅ (page.php) Página Servicios: ' . $slug_actual); Timber::render('templates/page-servicios.twig', $context); } elseif ( $cast_subpagina_servicios || $eusk_subpagina_zerbitzu ) { error_log('✅ (page.php) Página "single-servicios": ' . $parent->post_name); Timber::render('templates/single-servicios.twig', $context); } elseif ( $subpagina_industria ) { //error_log('✅ (page.php) Página "Industria": ' . $parent->post_name); Timber::render('templates/single-industria.twig', $context); } elseif ( $slug_actual === 'noticias' || $slug_actual === 'berriak') { // $context['posts_noticias'] = Timber::get_posts(array( // 'post_type' => 'post', // 'cat' => get_cat_ID('noticias'), // Obtiene los posts de la categoría "noticias" // )); error_log('🔴 (page.php) Página noticias - ERROR'); // Timber::render('templates/page-noticias.twig', $context); } else { error_log('✅ (page.php) Página: ' . $parent->post_name); Timber::render(array('templates/page-' . $timber_post->post_name . '.twig'), $context); }