pagination opinion
This commit is contained in:
13
archive-opinion.php
Normal file
13
archive-opinion.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* Archive Opinion
|
||||
*/
|
||||
|
||||
$context = Timber::context();
|
||||
|
||||
// WordPress ya tiene la paginación correcta en la query
|
||||
$context['posts_opinion'] = Timber::get_posts();
|
||||
|
||||
error_log('✅ Archive opinion - Posts: ' . count($context['posts_opinion']));
|
||||
|
||||
Timber::render('templates/page-opinion.twig', $context);
|
||||
17
page.php
17
page.php
@ -22,21 +22,28 @@ $context['search_query'] = get_search_query();
|
||||
|
||||
$parent = get_post($timber_post->post_parent);
|
||||
// Verificar si es una subpágina de servicios
|
||||
$es_subpagina_servicios = ($parent && ($parent->post_name === 'servicios-privados' || $parent->post_name === 'servicios-publicos'));
|
||||
$cast_subpagina_servicios = ($parent && ($parent->post_name === 'servicios-privados' || $parent->post_name === 'servicios-publicos'));
|
||||
$eusk_subpagina_zerbitzu = ($parent && ($parent->post_name === 'zerbitzu-pribatuak' || $parent->post_name === 'zerbitzu-publikoak'));
|
||||
$subpagina_industria = ($parent && ($parent->post_name === 'industria'));
|
||||
// Verificar si es una página padre de servicios
|
||||
$slug_actual = $post->post_name;
|
||||
$es_pagina_servicios = ($slug_actual === 'servicios-privados' || $slug_actual === 'servicios-publicos');
|
||||
//error_log('✅ Slug actual: ' . $slug_actual);
|
||||
$pagina_servicios = ($slug_actual === 'servicios-privados' || $slug_actual === 'servicios-publicos' || $slug_actual === 'zerbitzu-pribatuak' || $slug_actual === 'zerbitzu-publikoak');
|
||||
|
||||
|
||||
if ($parent && ($parent->post_name === 'contactos' || $parent->post_name === 'kontaktua') ) {
|
||||
// subpáginas de contactos
|
||||
Timber::render('templates/page-contactos.twig', $context);
|
||||
} elseif ($es_pagina_servicios) {
|
||||
} elseif ($pagina_servicios) {
|
||||
//error_log('✅ Página padre de servicios: ' . $slug_actual);
|
||||
Timber::render('templates/page-servicios.twig', $context);
|
||||
} elseif ($es_subpagina_servicios) {
|
||||
//error_log('✅ Página "Servicios": ' . $parent->post_name);
|
||||
} elseif ( $cast_subpagina_servicios || $eusk_subpagina_zerbitzu ) {
|
||||
error_log('✅ Página "Servicios": ' . $parent->post_name);
|
||||
Timber::render('templates/single-servicios.twig', $context);
|
||||
} elseif ( $subpagina_industria ) {
|
||||
error_log('✅ Página "Industria": ' . $parent->post_name);
|
||||
Timber::render('templates/single-industria.twig', $context);
|
||||
} else {
|
||||
error_log('✅ Página: ' . $parent->post_name);
|
||||
Timber::render(array('templates/page-' . $timber_post->post_name . '.twig'), $context);
|
||||
}
|
||||
64
views/templates/page-opinion.twig
Normal file
64
views/templates/page-opinion.twig
Normal file
@ -0,0 +1,64 @@
|
||||
{% extends 'layouts/base.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<h1 class="mb-5 position-relative fs-3 fw-bold sp-module-title">{{ post.title }}</h1>
|
||||
|
||||
<section class="posts-noticias">
|
||||
|
||||
{% if posts_opinion %}
|
||||
|
||||
|
||||
{% for noticias in posts_opinion %}
|
||||
|
||||
{% set imagen = noticias.thumbnail.src | default('/wp-content/uploads/2025/10/Imagen_por_defecto.png') %}
|
||||
{% set alt = noticias.thumbnail.alt | default('Imagen por defecto') %}
|
||||
|
||||
<div class="card my-3 position-relative">
|
||||
<div class="row g-0">
|
||||
<div class="col-md-4">
|
||||
<a href="{{ noticias.link }}" title="{{ noticias.title }}">
|
||||
<img src="{{ imagen }}"
|
||||
class="rounded-start object-fit-cover w-100 h-100 img-noticias"
|
||||
alt="{{ alt }}"
|
||||
style="min-height: 200px;"
|
||||
/>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="card-body" style="padding-bottom: 60px;">
|
||||
<a href="{{ noticias.link }}" title="{{ noticias.title }}" class="text-decoration-none card-title">
|
||||
<h5 class="card-title-text">{{ noticias.title }}</h5>
|
||||
</a>
|
||||
<p class="card-text"> {{
|
||||
noticias.excerpt({
|
||||
words: 50,
|
||||
read_more: ''
|
||||
})
|
||||
}}</p>
|
||||
<p class="card-text"><small class="text-body-secondary">{{ noticias.date }}</small></p>
|
||||
<a href="{{ noticias.link }}"
|
||||
class="btn position-absolute btn-secondary-cnt"
|
||||
style="position: absolute; bottom: 15px; right: 15px; z-index: 10;"
|
||||
>
|
||||
{{ __('Sigue leyendo', 'Sindikatua') }}...
|
||||
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<h2>no hay artículos</h2>
|
||||
{% endif %}
|
||||
|
||||
{% set pagination = posts_opinion.pagination %}
|
||||
|
||||
<div class="pagination-custom mt-5">
|
||||
{% include 'partials/pagination-custom.twig' %}
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user