From 7d78d3ce26747d813c0df6006d2c701ec7531427 Mon Sep 17 00:00:00 2001
From: gustavo
Date: Fri, 1 Aug 2025 12:58:48 +0000
Subject: [PATCH] ADD content & styles
---
src/StarterSite.php | 131 ++++++++++++++++++-
style.css | 39 +++++-
views/templates/page-barakaldo.twig | 45 ++++++-
views/templates/page-documentos.twig | 103 ++++++++-------
views/templates/page-enlaces.twig | 52 +++++++-
views/templates/page-industria.twig | 4 +-
views/templates/page-servicios-privados.twig | 32 ++++-
views/templates/page-servicios-publicos.twig | 33 ++++-
8 files changed, 374 insertions(+), 65 deletions(-)
diff --git a/src/StarterSite.php b/src/StarterSite.php
index 4d7206c..c20079a 100644
--- a/src/StarterSite.php
+++ b/src/StarterSite.php
@@ -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;
}
diff --git a/style.css b/style.css
index 133873d..679094b 100644
--- a/style.css
+++ b/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;
+}
\ No newline at end of file
diff --git a/views/templates/page-barakaldo.twig b/views/templates/page-barakaldo.twig
index fc5cd0a..90ccd30 100644
--- a/views/templates/page-barakaldo.twig
+++ b/views/templates/page-barakaldo.twig
@@ -1,6 +1,49 @@
{% extends 'layouts/base.twig' %}
{% block content %}
-BARAKALDO
+
+
+ Barakaldo
+
{% endblock %}
diff --git a/views/templates/page-documentos.twig b/views/templates/page-documentos.twig
index d1daf5e..e580151 100644
--- a/views/templates/page-documentos.twig
+++ b/views/templates/page-documentos.twig
@@ -5,67 +5,66 @@
Dokumentuak / Documentos
-
-
- {% if documentos %}
- {#
{{ dump(documentos) }}
#}
+
+
+ {% if documentos %}
+ {#
{{ dump(documentos) }}
#}
- {% for doc in documentos %}
-
-
-
-
- {% if doc.thumbnail %}
-

- {% else %}
-
-
-
- {% endif %}
+ {% for doc in documentos %}
+
+
-
-
-
- {% if doc.content %}
-
{{ doc.content }}
- {% endif %}
-
+
+
+ {% if doc.thumbnail %}
+

+ {% else %}
+
+
+
+ {% endif %}
+
+
+
+
+ {% if doc.content %}
+
{{ doc.content }}
+ {% endif %}
+
-
+ {% endfor %}
+ {% else %}
+
+ No hay documentos disponibles.
- {% endfor %}
- {% else %}
-
- No hay documentos disponibles.
-
- {% endif %}
-
-
-
+ {% endif %}
+
+
{% endblock %}
diff --git a/views/templates/page-enlaces.twig b/views/templates/page-enlaces.twig
index b09c430..ee94f16 100644
--- a/views/templates/page-enlaces.twig
+++ b/views/templates/page-enlaces.twig
@@ -1,7 +1,55 @@
{% extends 'layouts/base.twig' %}
{% block content %}
-
- Enlaces ---- A simple warning alert—check it out!
+
+
+ Enlaces
+
+ {% if enlaces %}
+
+
+ {% for grupo in enlaces %}
+
+
+
+
+ {% if grupo.enlaces %}
+
+ {% endif %}
+
+
+
+ {% endfor %}
+
+ {% endif %}
+
+ {#
{{ dump(enlaces) }}
#}
+
{% endblock %}
diff --git a/views/templates/page-industria.twig b/views/templates/page-industria.twig
index add5ab4..da17a67 100644
--- a/views/templates/page-industria.twig
+++ b/views/templates/page-industria.twig
@@ -1,6 +1,8 @@
{% extends 'layouts/base.twig' %}
{% block content %}
-
INDUSTRIA
+
+
+ Industria
{% endblock %}
diff --git a/views/templates/page-servicios-privados.twig b/views/templates/page-servicios-privados.twig
index 6353a11..04c1273 100644
--- a/views/templates/page-servicios-privados.twig
+++ b/views/templates/page-servicios-privados.twig
@@ -1,6 +1,36 @@
{% extends 'layouts/base.twig' %}
{% block content %}
-
SERVICIOS PRIVADOS
+
+
+ Servicios Privados
+
+
+
+ {% for pagina in subpaginas_servicios_privados %}
+
+
+
+ {% if pagina.thumbnail %}
+

+ {% else %}
+
no hay thumbnail
+ {% endif %}
+
+
{{ pagina.title }}
+
{{ pagina.content }}
+
+
+
+
+ {% else %}
+
No hay subpáginas disponibles.
+ {% endfor %}
+
+
+
+
{% endblock %}
diff --git a/views/templates/page-servicios-publicos.twig b/views/templates/page-servicios-publicos.twig
index c08ad20..673fd1c 100644
--- a/views/templates/page-servicios-publicos.twig
+++ b/views/templates/page-servicios-publicos.twig
@@ -1,5 +1,36 @@
{% extends 'layouts/base.twig' %}
{% block content %}
-
SERVICIOS PÚBLICOS
+
+
+ Servicios Públicos
+
+
+
+
+ {% for pagina in subpaginas_servicios_publicos %}
+
+
+
+ {% if pagina.thumbnail %}
+

+ {% else %}
+
no hay thumbnail
+ {% endif %}
+
+
{{ pagina.title }}
+
{{ pagina.content }}
+
+
+
+
+ {% else %}
+
No hay subpáginas disponibles.
+ {% endfor %}
+
+
+
+
{% endblock %}