refactor videos
This commit is contained in:
9
NewArchive.md
Normal file
9
NewArchive.md
Normal 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
12
archive-videos.php
Normal 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);
|
||||||
@ -13,7 +13,7 @@ namespace App;
|
|||||||
use Timber\Timber;
|
use Timber\Timber;
|
||||||
|
|
||||||
$templates = [ 'templates/archive.twig', 'templates/index.twig' ];
|
$templates = [ 'templates/archive.twig', 'templates/index.twig' ];
|
||||||
error_log('✅ estamos en archive.php');
|
error_log('✅ Pasamos por archive.php');
|
||||||
|
|
||||||
$title = 'Archive';
|
$title = 'Archive';
|
||||||
if ( is_day() ) {
|
if ( is_day() ) {
|
||||||
|
|||||||
@ -17,7 +17,7 @@ require_once __DIR__ . '/vendor/autoload.php';
|
|||||||
Timber::init();
|
Timber::init();
|
||||||
$site = new StarterSite();
|
$site = new StarterSite();
|
||||||
|
|
||||||
// Ruta para la página principal 'noticias'
|
// Ruta para la página de 'noticias'
|
||||||
foreach(['/es/noticias','/eu/berriak'] as $route) {
|
foreach(['/es/noticias','/eu/berriak'] as $route) {
|
||||||
Routes::map($route, function($params){
|
Routes::map($route, function($params){
|
||||||
$query = false;
|
$query = false;
|
||||||
|
|||||||
7
page.php
7
page.php
@ -44,13 +44,8 @@ if ($parent && ($parent->post_name === 'contactos' || $parent->post_name === 'ko
|
|||||||
//error_log('✅ (page.php) Página "Industria": ' . $parent->post_name);
|
//error_log('✅ (page.php) Página "Industria": ' . $parent->post_name);
|
||||||
Timber::render('templates/single-industria.twig', $context);
|
Timber::render('templates/single-industria.twig', $context);
|
||||||
} elseif ( $slug_actual === 'noticias' || $slug_actual === 'berriak') {
|
} 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');
|
error_log('🔴 (page.php) Página noticias - ERROR');
|
||||||
// Timber::render('templates/page-noticias.twig', $context);
|
|
||||||
} else {
|
} 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);
|
Timber::render(array('templates/page-' . $timber_post->post_name . '.twig'), $context);
|
||||||
}
|
}
|
||||||
@ -12,6 +12,7 @@ $context = Timber::context(
|
|||||||
'posts_conflicts' => $site->getLastPostConflicts(),
|
'posts_conflicts' => $site->getLastPostConflicts(),
|
||||||
'lasts_posts_news' => $site->getLastsPostsNews(),
|
'lasts_posts_news' => $site->getLastsPostsNews(),
|
||||||
'botones_imagen' => $site->getBotonesEnlaces(),
|
'botones_imagen' => $site->getBotonesEnlaces(),
|
||||||
|
'videos' => $site->getVideosSlider(),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user