ADD content & styles
This commit is contained in:
@ -369,7 +369,7 @@ class StarterSite extends Site {
|
||||
'posts_per_page' => -1,
|
||||
]);
|
||||
|
||||
error_log('Número de posts encontrados: ' . count($posts));
|
||||
//error_log('✅ Número de posts "Documentos" encontrados: ' . count($posts));
|
||||
|
||||
$documentos = [];
|
||||
|
||||
@ -398,6 +398,131 @@ class StarterSite extends Site {
|
||||
return $documentos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtiene los grupos de enlaces de la página "Enlaces"
|
||||
*/
|
||||
private function getEnlaces() {
|
||||
$grupos = [];
|
||||
|
||||
// Buscar página por su slug
|
||||
$page = get_page_by_path('enlaces');
|
||||
|
||||
if (!$page) {
|
||||
error_log('🔴 Página "enlaces" no encontrada con get_page_by_path().');
|
||||
return [];
|
||||
}
|
||||
|
||||
if (!have_rows('grupos_enlaces', $page->ID)) {
|
||||
error_log('🔴 Array vacío');
|
||||
return [];
|
||||
} else {
|
||||
//error_log('✅ "grupos_enlaces" tiene filas.');
|
||||
}
|
||||
|
||||
// Si se encuentra la página y el campo tiene filas
|
||||
if ($page && have_rows('grupos_enlaces', $page->ID)) {
|
||||
|
||||
$field = get_field('grupos_enlaces', $page->ID);
|
||||
//error_log('📦 Contenido de get_field: ' . print_r($field, true));
|
||||
//error_log('✅ Página "enlaces" encontrada con ID: ' . $page->ID);
|
||||
|
||||
while (have_rows('grupos_enlaces', $page->ID)) {
|
||||
the_row();
|
||||
|
||||
$grupo = [
|
||||
'titulo' => get_sub_field('titulo_grupo'),
|
||||
'enlaces' => []
|
||||
];
|
||||
|
||||
// Recorrer enlaces dentro del grupo
|
||||
if (have_rows('enlaces')) {
|
||||
while (have_rows('enlaces')) {
|
||||
the_row();
|
||||
|
||||
$titulo_enlace = get_sub_field('titulo_enlace');
|
||||
$url_enlace = get_sub_field('url_enlace');
|
||||
|
||||
if (!empty($titulo_enlace) && !empty($url_enlace)) {
|
||||
$enlace = [
|
||||
'titulo' => $titulo_enlace,
|
||||
'url' => $url_enlace,
|
||||
'target' => get_sub_field('target_enlace') ?: '_self'
|
||||
];
|
||||
|
||||
$grupo['enlaces'][] = $enlace;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Añadir grupo solo si tiene título y enlaces válidos
|
||||
if (!empty($grupo['titulo']) && !empty($grupo['enlaces'])) {
|
||||
$grupos[] = $grupo;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $grupos;
|
||||
}
|
||||
|
||||
// Get subpages of "servicios publicos"
|
||||
private function getPaginasServiciosPublicos() {
|
||||
|
||||
$pag_servicios_publicos = get_page_by_path('accion-sindical/servicios-publicos');
|
||||
|
||||
if (!$pag_servicios_publicos) {
|
||||
error_log('🔴 Página "Servicios públicos" no encontrada.');
|
||||
return [];
|
||||
}
|
||||
|
||||
$subpaginas = Timber::get_posts([
|
||||
'post_type' => 'page',
|
||||
'post_status' => 'publish',
|
||||
'post_parent' => $pag_servicios_publicos->ID,
|
||||
'orderby' => 'menu_order',
|
||||
'order' => 'ASC',
|
||||
'posts_per_page' => -1,
|
||||
]);
|
||||
|
||||
foreach ($subpaginas as $pagina) {
|
||||
//$pagina->imagen = $pagina->thumbnail ? $pagina->thumbnail->src('medium') : null;
|
||||
$pagina->thumbnail= get_the_post_thumbnail_url($pagina->ID);
|
||||
}
|
||||
|
||||
return $subpaginas;
|
||||
}
|
||||
|
||||
// Get subpages of "servicios privados"
|
||||
private function getPaginasServiciosPrivados() {
|
||||
|
||||
$pag_servicios_privados = get_page_by_path('accion-sindical/servicios-privados');
|
||||
|
||||
if (!$pag_servicios_privados) {
|
||||
error_log('🔴 Página "Servicios privados" no encontrada.');
|
||||
return [];
|
||||
}
|
||||
|
||||
$subpaginas = Timber::get_posts([
|
||||
'post_type' => 'page',
|
||||
'post_status' => 'publish',
|
||||
'post_parent' => $pag_servicios_privados->ID,
|
||||
'orderby' => 'menu_order',
|
||||
'order' => 'ASC',
|
||||
'posts_per_page' => -1,
|
||||
]);
|
||||
|
||||
foreach ($subpaginas as $pagina) {
|
||||
//$pagina->imagen = $pagina->thumbnail ? $pagina->thumbnail->src('medium') : null;
|
||||
$pagina->thumbnail= get_the_post_thumbnail_url($pagina->ID);
|
||||
}
|
||||
|
||||
return $subpaginas;
|
||||
}
|
||||
|
||||
private function formContact() {
|
||||
$form_test = do_shortcode('[contact-form-7 id="5ed613c" title="Formulario de contacto 1"]');
|
||||
|
||||
return $form_test;
|
||||
}
|
||||
|
||||
//Global variables
|
||||
public function add_global_context($context) {
|
||||
@ -413,6 +538,10 @@ class StarterSite extends Site {
|
||||
$context['posts_campana'] = $this->getCampanaArticles();
|
||||
$context['paginas_acerca'] = $this->getPaginasAcerca();
|
||||
$context['documentos'] = $this->getDocumentos();
|
||||
$context['enlaces'] = $this->getEnlaces();
|
||||
$context['subpaginas_servicios_publicos'] = $this->getPaginasServiciosPublicos();
|
||||
$context['subpaginas_servicios_privados'] = $this->getPaginasServiciosPrivados();
|
||||
$context['form_test'] = $this->formContact();;
|
||||
|
||||
return $context;
|
||||
}
|
||||
|
39
style.css
39
style.css
@ -3,6 +3,12 @@
|
||||
* Description: Tema Timber de nexos
|
||||
* Author: nexos estudios
|
||||
*/
|
||||
|
||||
:root {
|
||||
--rojo-cnt: #dc2d30;
|
||||
--color-secundario: #6C757D;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'Yaro';
|
||||
src: url('assets/fonts/yaro-font-family/YaroSt-Black.ttf') format('truetype');
|
||||
@ -99,7 +105,7 @@
|
||||
}
|
||||
|
||||
.recent-posts .card-title a:hover {
|
||||
color: #E30B16;
|
||||
color: var(--rojo-cnt);
|
||||
}
|
||||
|
||||
.recent-posts .card.secondary-article .card-title {
|
||||
@ -120,8 +126,9 @@
|
||||
}
|
||||
|
||||
/* PORTADA -> Titles */
|
||||
.page-portada .sp-module-title::after {
|
||||
background: #cc1d1a;
|
||||
.page-portada .sp-module-title::after,
|
||||
.contacto-barakaldo .sp-module-title::after {
|
||||
background: var(--rojo-cnt);
|
||||
content: "";
|
||||
height: 1px;
|
||||
left: 0;
|
||||
@ -130,8 +137,9 @@
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
.page-portada .sp-module-title::before {
|
||||
background: #cc1d1a;
|
||||
.page-portada .sp-module-title::before,
|
||||
.contacto-barakaldo .sp-module-title::before {
|
||||
background: var(--rojo-cnt);
|
||||
content: "";
|
||||
height: 1px;
|
||||
left: 0;
|
||||
@ -180,5 +188,24 @@
|
||||
}
|
||||
|
||||
.active-acerca {
|
||||
background-color: #dc2d30;
|
||||
background-color: var(--rojo-cnt);
|
||||
}
|
||||
|
||||
.servicios-publicos .card img,
|
||||
.servicios-privados .card img {
|
||||
width: 100%;
|
||||
max-width: 50%;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.enlaces button:not(.collapsed) {
|
||||
background-color: var(--rojo-cnt);
|
||||
color: #fff;
|
||||
border-color: none;
|
||||
}
|
||||
|
||||
.enlaces button:focus,
|
||||
.enlaces button:active {
|
||||
outline: none;
|
||||
box-shadow: none;
|
||||
}
|
@ -1,6 +1,49 @@
|
||||
{% extends 'layouts/base.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<h1 class="text-bg-primary text-wrap">BARAKALDO</h1>
|
||||
<p class="alert alert-info" role="alert">
|
||||
<i class="bi bi-envelope-at"></i>
|
||||
Barakaldo</p>
|
||||
|
||||
<section class="contacto-barakaldo">
|
||||
<div class="container my-5">
|
||||
<div class="row">
|
||||
|
||||
<!-- Column map -->
|
||||
<div class="col-md-6 mb-4 mb-md-0">
|
||||
<div class="ratio ratio-4x3">
|
||||
{# Aquí puedes incrustar un iframe o un mapa generado #}
|
||||
<iframe width="425"
|
||||
height="350"
|
||||
src="https://www.openstreetmap.org/export/embed.html?bbox=-2.986932098865509%2C43.29429552013704%2C-2.984805107116699%2C43.29620671523328&layer=mapnik"
|
||||
style="border: 1px solid black">
|
||||
</iframe><br/>
|
||||
|
||||
</div>
|
||||
<small><a href="https://www.openstreetmap.org/?#map=19/43.295251/-2.985869">Ver el mapa más grande</a></small>
|
||||
</div>
|
||||
|
||||
<!-- Column content -->
|
||||
<div class="col-md-6">
|
||||
<div class="content">
|
||||
{{ page.content }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- formulario -->
|
||||
<div class="row mt-5">
|
||||
<div class="col-12">
|
||||
<p class="mb-4 position-relative fs-4 fw-bold sp-module-title">Contacto</p>
|
||||
|
||||
<div class="formulario-contacto">
|
||||
{{ form_test | raw }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
@ -5,67 +5,66 @@
|
||||
<i class="bi bi-folder-fill"></i>
|
||||
Dokumentuak / Documentos</p>
|
||||
|
||||
<section class="documentos">
|
||||
<div class="container">
|
||||
{% if documentos %}
|
||||
{#<pre>{{ dump(documentos) }}</pre>#}
|
||||
<section class="documentos">
|
||||
<div class="container">
|
||||
{% if documentos %}
|
||||
{#<pre>{{ dump(documentos) }}</pre>#}
|
||||
|
||||
{% for doc in documentos %}
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">
|
||||
<h6 class="card-title mb-1">{{ doc.title }}</h6>
|
||||
</div>
|
||||
<div class="row g-0">
|
||||
<div class="col-2">
|
||||
{% if doc.thumbnail %}
|
||||
<img src="{{ doc.thumbnail }}"
|
||||
class="img-fluid object-fit-cover"
|
||||
alt="{{ doc.title }}"
|
||||
loading="lazy"
|
||||
>
|
||||
{% else %}
|
||||
<div class="bg-light d-flex align-items-center justify-content-center h-100 rounded-start">
|
||||
<i class="bi bi-file-earmark-image-fill"></i>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% for doc in documentos %}
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">
|
||||
<h6 class="card-title mb-1">{{ doc.title }}</h6>
|
||||
</div>
|
||||
<div class="col-10">
|
||||
<div class="card-body d-flex flex-column justify-content-between h-100 py-2">
|
||||
<div>
|
||||
{% if doc.content %}
|
||||
<p class="card-text small mb-2">{{ doc.content }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="row g-0">
|
||||
<div class="col-2">
|
||||
{% if doc.thumbnail %}
|
||||
<img src="{{ doc.thumbnail }}"
|
||||
class="img-fluid object-fit-cover"
|
||||
alt="{{ doc.title }}"
|
||||
loading="lazy"
|
||||
>
|
||||
{% else %}
|
||||
<div class="bg-light d-flex align-items-center justify-content-center h-100 rounded-start">
|
||||
<i class="bi bi-file-earmark-image-fill"></i>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-10">
|
||||
<div class="card-body d-flex flex-column justify-content-between h-100 py-2">
|
||||
<div>
|
||||
{% if doc.content %}
|
||||
<p class="card-text small mb-2">{{ doc.content }}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{% if doc.documento_url %}
|
||||
<a href="{{ doc.documento_url }}"
|
||||
class="btn btn-primary btn-sm me-2"
|
||||
target="_blank">
|
||||
<i class="bi bi-eye-fill"></i>
|
||||
Ver documento
|
||||
</a>
|
||||
<div>
|
||||
{% if doc.documento_url %}
|
||||
<a href="{{ doc.documento_url }}"
|
||||
class="btn btn-primary btn-sm me-2"
|
||||
target="_blank">
|
||||
<i class="bi bi-eye-fill"></i>
|
||||
Ver documento
|
||||
</a>
|
||||
|
||||
<a href="{{ doc.documento_url }}" download
|
||||
class="btn btn-primary btn-sm me-2" >
|
||||
<i class="bi bi-cloud-download-fill"></i>
|
||||
Descargar
|
||||
</a>
|
||||
<a href="{{ doc.documento_url }}" download
|
||||
class="btn btn-primary btn-sm me-2" >
|
||||
<i class="bi bi-cloud-download-fill"></i>
|
||||
Descargar
|
||||
</a>
|
||||
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<div class="alert alert-info" role="alert">
|
||||
No hay documentos disponibles.
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% else %}
|
||||
<div class="alert alert-info" role="alert">
|
||||
No hay documentos disponibles.
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{% endif %}
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
@ -1,7 +1,55 @@
|
||||
{% extends 'layouts/base.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="alert alert-warning" role="alert">
|
||||
Enlaces ---- A simple warning alert—check it out!
|
||||
<p class="alert alert-info" role="alert">
|
||||
<i class="bi bi-link-45deg"></i>
|
||||
Enlaces</p>
|
||||
|
||||
{% if enlaces %}
|
||||
<div class="enlaces">
|
||||
<div class="accordion" id="accordionEnlaces">
|
||||
{% for grupo in enlaces %}
|
||||
<div class="accordion-item">
|
||||
<h2 class="accordion-header">
|
||||
|
||||
<button class="accordion-button {% if loop.index0 != 0 %}collapsed{% endif %}"
|
||||
type="button"
|
||||
data-bs-toggle="collapse"
|
||||
data-bs-target="#collapse{{ loop.index }}"
|
||||
aria-expanded="{% if loop.index0 == 0 %}true{% else %}false{% endif %}"
|
||||
aria-controls="collapse{{ loop.index }}">
|
||||
{{ grupo.titulo }}
|
||||
|
||||
<span class="badge bg-secondary ms-2">{{ grupo.enlaces|length }}</span>
|
||||
</button>
|
||||
</h2>
|
||||
<div id="collapse{{ loop.index }}"
|
||||
class="accordion-collapse collapse {% if loop.index0 == 0 %}show{% endif %}"
|
||||
data-bs-parent="#accordionEnlaces">
|
||||
<div class="accordion-body">
|
||||
{% if grupo.enlaces %}
|
||||
<div class="d-grid gap-2">
|
||||
{% for enlace in grupo.enlaces %}
|
||||
<a href="{{ enlace.url }}"
|
||||
class="btn btn-outline-dark btn-sm text-start"
|
||||
target == '_blank'
|
||||
rel="noopener noreferrer">
|
||||
{{ enlace.titulo }}
|
||||
{% if enlace.target == '_blank' %}
|
||||
<i class="fas fa-external-link-alt ms-1 small"></i>
|
||||
{% endif %}
|
||||
</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{#<pre>{{ dump(enlaces) }}</pre>#}
|
||||
|
||||
{% endblock %}
|
||||
|
@ -1,6 +1,8 @@
|
||||
{% extends 'layouts/base.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<h1 class=" text-bg-primary text-wrap">INDUSTRIA</h1>
|
||||
<p class="alert alert-info" role="alert">
|
||||
<i class="bi bi-folder-fill"></i>
|
||||
Industria</p>
|
||||
|
||||
{% endblock %}
|
||||
|
@ -1,6 +1,36 @@
|
||||
{% extends 'layouts/base.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<h1 class="text-bg-primary text-wrap">SERVICIOS PRIVADOS</h1>
|
||||
<p class="alert alert-info" role="alert">
|
||||
<i class="bi bi-folder-fill"></i>
|
||||
Servicios Privados</p>
|
||||
|
||||
<section class="grid servicios-privados">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
{% for pagina in subpaginas_servicios_privados %}
|
||||
<div class="col-12 mb-2">
|
||||
<article>
|
||||
<div class="card">
|
||||
{% if pagina.thumbnail %}
|
||||
<img src="{{ pagina.thumbnail.src}}"
|
||||
alt="{{ pagina.thumbnail.alt }}"
|
||||
>
|
||||
{% else %}
|
||||
<p>no hay thumbnail </p>
|
||||
{% endif %}
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">{{ pagina.title }}</h5>
|
||||
<p class="card-text">{{ pagina.content }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
{% else %}
|
||||
<p>No hay subpáginas disponibles.</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{% endblock %}
|
||||
|
@ -1,5 +1,36 @@
|
||||
{% extends 'layouts/base.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<h1 class="text-bg-primary text-wrap">SERVICIOS PÚBLICOS</h1>
|
||||
<p class="alert alert-info" role="alert">
|
||||
<i class="bi bi-folder-fill"></i>
|
||||
Servicios Públicos</p>
|
||||
|
||||
<section class="grid servicios-publicos">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
{% for pagina in subpaginas_servicios_publicos %}
|
||||
<div class="col-12 mb-2">
|
||||
<article>
|
||||
<div class="card">
|
||||
{% if pagina.thumbnail %}
|
||||
<img src="{{ pagina.thumbnail.src}}"
|
||||
alt="{{ pagina.thumbnail.alt }}"
|
||||
>
|
||||
{% else %}
|
||||
<p>no hay thumbnail </p>
|
||||
{% endif %}
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">{{ pagina.title }}</h5>
|
||||
<p class="card-text">{{ pagina.content }}</p>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
{% else %}
|
||||
<p>No hay subpáginas disponibles.</p>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{% endblock %}
|
||||
|
Reference in New Issue
Block a user