refactor videos

This commit is contained in:
2025-10-15 15:33:50 +00:00
parent 096b6c90a4
commit b038f66178
6 changed files with 25 additions and 8 deletions

9
NewArchive.md Normal file
View File

@ -0,0 +1,9 @@
En Traducciones > ajustes > post type: marcar el post type.
==========================
En ACF marcar archive y jerárquico.
En URLs añadir el nombre del slug (Ej: videos)
==========================
Crear archive-slug.php (Ej: archive-videos.php)
==========================

12
archive-videos.php Normal file
View File

@ -0,0 +1,12 @@
<?php
/**
* Archive Videos
*/
$context = Timber::context();
// WordPress ya tiene la paginación correcta en la query
$context['videos'] = Timber::get_posts();
error_log('✅ archive-videos - Posts: ' . count($context['videos']));
Timber::render('templates/page-videos.twig', $context);

View File

@ -13,7 +13,7 @@ namespace App;
use Timber\Timber;
$templates = [ 'templates/archive.twig', 'templates/index.twig' ];
error_log('✅ estamos en archive.php');
error_log('✅ Pasamos por archive.php');
$title = 'Archive';
if ( is_day() ) {

View File

@ -17,7 +17,7 @@ require_once __DIR__ . '/vendor/autoload.php';
Timber::init();
$site = new StarterSite();
// Ruta para la página principal 'noticias'
// Ruta para la página de 'noticias'
foreach(['/es/noticias','/eu/berriak'] as $route) {
Routes::map($route, function($params){
$query = false;

View File

@ -44,13 +44,8 @@ if ($parent && ($parent->post_name === 'contactos' || $parent->post_name === 'ko
//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);
error_log('✅ (page.php) Página General: ' . $parent->post_name);
Timber::render(array('templates/page-' . $timber_post->post_name . '.twig'), $context);
}

View File

@ -12,6 +12,7 @@ $context = Timber::context(
'posts_conflicts' => $site->getLastPostConflicts(),
'lasts_posts_news' => $site->getLastsPostsNews(),
'botones_imagen' => $site->getBotonesEnlaces(),
'videos' => $site->getVideosSlider(),
]
);