Files
cnt-sindikatua/page.php

38 lines
1.7 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.
*/
$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->slug . '.twig', 'page.twig' ), $context );
$parent = $timber_post->parent;
$slug_actual = $timber_post->slug;
$pagina_servicios = ($slug_actual === 'servicios-privados' || $slug_actual === 'servicios-publicos' || $slug_actual === 'zerbitzu-pribatuak' || $slug_actual === 'zerbitzu-publikoak');
if ($parent && ($parent->slug === 'contactos' || $parent->slug === '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 ( $slug_actual === 'noticias' || $slug_actual === 'berriak') {
error_log('🔴 (page.php) Página noticias - ERROR');
} elseif ($parent && ($parent->slug == 'acerca-de-la-cnt' || $parent->slug == 'cnt-ri-buruz') ) {
$context['es_subpagina'] = true;
$context['subpagina'] = $timber_post;
$context['post'] = $timber_post->parent;
Timber::render(array('templates/page-acerca-de-la-cnt.twig'), $context);
} else {
error_log('✅ (page.php) Página General: ' . $timber_post->slug);
Timber::render(array('templates/page-' . $timber_post->slug . '.twig', 'templates/page.twig'), $context);
}