Files
cnt-sindikatua/page.php
2025-08-13 08:58:35 +00:00

34 lines
1.3 KiB
PHP

<?php
/**
* The template for displaying all pages.
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages
* and that other 'pages' on your WordPress site will use a
* different template.
*/
/**namespace App;
use Timber\Timber;
$context = Timber::context();
Timber::render( 'templates/page.twig', $context );*/
$context = Timber::context();
$timber_post = Timber::get_post();
$context['post'] = $timber_post;
$context['search_query'] = get_search_query();
//Timber::render( array( 'templates/page-' . $timber_post->post_name . '.twig', 'page.twig' ), $context );
// Verificar si es subpágina de contactos
$parent = get_post($timber_post->post_parent);
if ($parent && $parent->post_name === 'contactos') {
// Para subpáginas de contactos, usar page-contactos.twig
Timber::render('templates/page-contactos.twig', $context);
} elseif ($parent && $parent->post_name === 'servicios-privados' || $parent && $parent->post_name === 'servicios-publicos') {
// Para subpáginas de servicios privados, usar page-servicio-individual.twig
Timber::render('templates/single-servicios.twig', $context);
} else {
// Para el resto, usar la lógica original
Timber::render(array('templates/page-' . $timber_post->post_name . '.twig'), $context);
}