diff --git a/archive-conflictos-laborales.php b/archive-conflictos-laborales.php new file mode 100644 index 0000000..a44f464 --- /dev/null +++ b/archive-conflictos-laborales.php @@ -0,0 +1,22 @@ + 'post', + 'cat' => $category ? $category->term_id : $ID_conflictos, + 'paged' => isset($params['paged']) ? $params['paged'] : 1, + 'posts_per_page' => get_option('posts_per_page') // Usa la configuración de WordPress + ); +$context['posts_conflictos'] = Timber::get_posts($query); +error_log('✅ archive-conflictos-laborales.php'); +//error_log('✅ archive-conflictos-laborales.php - Posts: ' . count($context['posts_conflictos'])); + +Timber::render('templates/page-conflictos-laborales.twig', $context); \ No newline at end of file diff --git a/archive-noticias.php b/archive-noticias.php index 36e9256..970e826 100644 --- a/archive-noticias.php +++ b/archive-noticias.php @@ -1,6 +1,6 @@ get_option('posts_per_page') // Usa la configuración de WordPress ); $context['posts_noticias'] = Timber::get_posts($query); -error_log('✅ category-noticias.php - Posts: ' . count($context['posts_noticias'])); +error_log('✅ archive-noticias.php - Posts: ' . count($context['posts_noticias'])); +// error_log('✅ archive-noticias.php - Posts: ' . count($context['posts_noticias'])); Timber::render('templates/page-noticias.twig', $context); \ No newline at end of file diff --git a/archive.md b/archive.md index 4fe51bf..865e01a 100644 --- a/archive.md +++ b/archive.md @@ -1,3 +1,6 @@ +========================== +========================== +ARCHIVE PARA POST TYPE CREADOS Idiomas > Ajustes > post type: marcar el post type. @@ -12,11 +15,24 @@ Crear archive-slug.php (Ej: archive-videos.php) Si se quieren recibir todos los posts, independientemente del idioma. Ejemplo: -$context['videos'] = Timber::get_posts([ +> $context['videos'] = Timber::get_posts([ 'post_type' => 'videos', 'posts_per_page' => -1, 'lang' => '' // Importante: vacío para obtener todos -]); + ]); +========================== ========================== +========================== +========================== +ARCHIVE PARA CATEGORIAS + +> Ir a functions.php y añadir rutas (para cada idioma) +> Crear archive-slug.php +> Crear página (para cada idioma) +> Crear page-slug.twig (para cada idioma) +> Añadir en el menú como "Enlaces personalizados" (para cada idioma) +> +> ¡OJO en el menú! Hay que ver si es subelemento para poner la ruta bien en el functions. + diff --git a/functions.php b/functions.php index 38dc666..c7f3e56 100644 --- a/functions.php +++ b/functions.php @@ -31,4 +31,20 @@ foreach(['/es/noticias/page/:paged','/eu/berriak/page/:paged'] as $route) { $query = false; Routes::load('archive-noticias.php', $params, $query, 200); }); -} \ No newline at end of file +} + +// Ruta para la página de 'Conflictos laborales' +foreach(['/es/noticias/conflictos-laborales','/eu/berriak/lan-gatazkak'] as $route) { + Routes::map($route, function($params){ + $query = false; + Routes::load('archive-conflictos-laborales.php', $params, $query, 200); + }); +} + +// Ruta para las páginas de paginación 'Conflictos laborales' +foreach(['/es/noticias/conflictos-laborales/page/:paged','/eu/berriak/lan-gatazkak/page/:paged'] as $route) { + Routes::map($route, function($params){ + $query = false; + Routes::load('archive-conflictos-laborales.php', $params, $query, 200); + }); +} diff --git a/views/templates/page-conflictos-laborales.twig b/views/templates/page-conflictos-laborales.twig new file mode 100644 index 0000000..6aee229 --- /dev/null +++ b/views/templates/page-conflictos-laborales.twig @@ -0,0 +1,60 @@ +{% extends 'layouts/base.twig' %} + +{% block content %} +
{{ + noticias.excerpt({ + words: 50, + read_more: '' + }) + }}
+{{ noticias.date }}
+ + {{ __('Sigue leyendo', 'Sindikatua') }}... + + +{{ __('No hay artículos', 'Sindikatua') }}
+ {% endif %} + + + {% set pagination = posts_conflictos.pagination %} +