Indicaciones del cliente: adopción solo Perros/Gatos, fichas nuevas y todo configurable
- Adopción sin filtros ni etiquetas: acceso a Perros y Gatos, tarjetas de foto y nombre. - Ficha nueva: galería, vídeo, fecha de nacimiento o edad aproximada, carácter, necesidades, convivencia y hogar que buscamos (textos por idioma, datos compartidos). - Estados disponible / en proceso / adoptado y animales destacados. - Botón «Quiero conocerlo/la» con formulario breve (animal incluido) y confirmación. - Botones para compartir cada ficha (WhatsApp, Facebook, copiar enlace). - Portada corta según la propuesta del cliente; donaciones, cifras, etc. ocultas. - Páginas Acoge y Preguntas frecuentes, menú con submenús, sin hotel. - Aviso de cita previa y lista de ayuda material editables desde el panel. - Plugin núcleo dividido en módulos (i18n, animales, formularios, APIs). - Migración 5 idempotente: respeta las páginas editadas por el cliente. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
35
README.md
35
README.md
@@ -19,6 +19,36 @@ Web de la protectora **Gure Ametsa Bi Lagun** (Jaizubia 44, Hondarribia), en cas
|
||||
- Formulario de contacto/adopción `[ga_contacto]`. Envía un email **y** guarda cada mensaje en *Mensajes* dentro del panel, así no se pierde aunque falle el correo.
|
||||
- Shortcode `[ga_animales numero="6" especie="perro" estado="urgente"]` para usar en cualquier página.
|
||||
|
||||
## Gestión del día a día (sin tocar código)
|
||||
|
||||
| Qué | Dónde |
|
||||
|---|---|
|
||||
| Añadir o editar un animal | **Animales → Añadir animal**. Arriba va la historia y debajo la ficha: <br>• Datos comunes a castellano y euskera: estado, destacado, sexo, nacimiento o edad aproximada, tamaño, fecha de entrada, más fotos y vídeo. <br>• Textos de cada idioma: cómo es, qué necesita, convivencia y el hogar que buscamos. <br>La versión en euskera se crea con el **+** de la caja «Idiomas»; los datos comunes y las fotos se copian solos. |
|
||||
| Estado | *Disponible*, *En proceso* o *Adoptado*. Los adoptados salen solos del listado. |
|
||||
| Animales de la portada | Marcar **Destacado** en su ficha. Si no hay ninguno, salen los que llevan más tiempo. |
|
||||
| Ayuda material | **Personalizar → Adopción y colabora → Ayuda material** (una línea por necesidad). |
|
||||
| Textos del botón «Quiero conocerlo/la», formulario, confirmación, proceso, correo de destino | **Personalizar → Adopción y colabora → Listado y fichas**. |
|
||||
| Aviso de cita previa, teléfono, horario | **Personalizar → Contacto y redes**. |
|
||||
| Portada | **Personalizar → Portada**: cada bloque se puede mostrar u ocultar y reordenar. Por defecto se ve: portada principal, animales destacados, acogida, quiénes somos y contacto. Donaciones, cifras, finales felices, etc. están ocultos. |
|
||||
| Menú | **Apariencia → Menús** (Principal / Nagusia). |
|
||||
| Páginas (Acoge, Colabora, Quiénes somos, Contacto, Preguntas frecuentes) | **Páginas**, con el editor de bloques y los patrones «Gure Ametsa». |
|
||||
| Mensajes recibidos | Menú **Mensajes** (además llegan por correo). |
|
||||
|
||||
Cada ficha tiene su propio enlace y botones para compartirla por WhatsApp o Facebook, o copiar el enlace.
|
||||
|
||||
## Migraciones
|
||||
|
||||
`docker/setup.sh` se ejecuta en cada arranque y aplica por etapas lo que falte (`ga_setup_version`):
|
||||
|
||||
| Etapa | Qué hace |
|
||||
|---|---|
|
||||
| 2 | Idiomas, tema, páginas y menús iniciales |
|
||||
| 3 | Plugins recomendados |
|
||||
| 4 | APIs (WPGraphQL, Swagger) |
|
||||
| 5 | Indicaciones del cliente: páginas Acoge y Preguntas frecuentes, menú con submenús, retirada del hotel, estados nuevos y sin animaciones |
|
||||
|
||||
`docker/setup-content.php` es idempotente. **Las páginas que el cliente haya editado nunca se sobrescriben**; se detecta con una huella del contenido original.
|
||||
|
||||
## Logo y colores
|
||||
|
||||
- El logo original se ha vectorizado en `wp-content/themes/gure-ametsa/assets/img/`:
|
||||
@@ -63,8 +93,8 @@ Para escribir en la API REST (crear o editar animales) se usan las *contraseñas
|
||||
El diseño está inspirado en [Beargrass Animal Rescue](https://louisvillewebguy.com/examples/beargrass-animal-rescue/):
|
||||
- **Tipografía:** títulos en Fraunces muy gruesa y texto en Karla. Las dos van incluidas en el tema, sin Google Fonts.
|
||||
- **Paletas:** por defecto, los colores del logo. También están ciruela y mostaza (la de Beargrass), verde y rojo, azul mar y bosque.
|
||||
- **Portada:** a pantalla completa con cuatro «puertas»: Adopta, Acoge, Voluntariado y Dona.
|
||||
- **Listado de animales:** panel de filtros por especie, tamaño, edad, sexo y compatibilidad.
|
||||
- **Portada:** a pantalla completa, con foto real y botones a perros y gatos.
|
||||
- **Listado de animales:** solo Perros y Gatos, con tarjetas de foto y nombre, sin filtros ni etiquetas, a petición del cliente.
|
||||
- **Pasos de adopción:** en tarjetas.
|
||||
- **Contacto:** sección oscura con el formulario en una tarjeta.
|
||||
- **Pie:** columnas de enlaces.
|
||||
@@ -128,7 +158,6 @@ Se instalan solos en el primer arranque (etapa 3 de `docker/setup.sh`).
|
||||
| Smash Balloon Instagram Feed | activo | Muestra vuestro Instagram. Hay que conectar la cuenta. |
|
||||
| Koko Analytics | activo | Estadísticas de visitas sin cookies. |
|
||||
| Kadence Blocks | activo | Bloques visuales extra: carruseles de imágenes, pestañas, acordeones e iconos. |
|
||||
| Blocks Animation | activo | Animaciones de entrada para cualquier bloque. |
|
||||
| GiveWP | desactivado | Donaciones online con tarjeta o PayPal. |
|
||||
| MailPoet | desactivado | Newsletter. |
|
||||
| Complianz | desactivado | Aviso de cookies. Solo hace falta si añadís YouTube, Analytics, etc. |
|
||||
|
||||
29
docker/content/es/acoge.html
Normal file
29
docker/content/es/acoge.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<!-- wp:paragraph -->
|
||||
<p>Quizá ahora no puedas adoptar, pero sí ofrecer un hogar durante un tiempo. Escríbenos y te contamos qué animales necesitan acogida y cómo puedes ayudar.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:heading -->
|
||||
<h2 class="wp-block-heading">¿Qué es una casa de acogida?</h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Es un hogar temporal para un perro o un gato mientras encuentra a su familia. Algunos lo necesitan especialmente: cachorros, animales mayores o que se están recuperando y que están mejor en una casa que en la protectora.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:heading -->
|
||||
<h2 class="wp-block-heading">¿Qué supone?</h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Cada acogida es distinta. Antes de empezar hablamos contigo de cuánto tiempo sería, los gastos, el material que hace falta y cómo te acompañamos durante la acogida.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:buttons -->
|
||||
<div class="wp-block-buttons"><!-- wp:button -->
|
||||
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="/contacto/?motivo=acogida#formulario">Quiero ser casa de acogida</a></div>
|
||||
<!-- /wp:button --></div>
|
||||
<!-- /wp:buttons -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>¿Tienes dudas? Mira las <a href="/preguntas-frecuentes/">preguntas frecuentes</a> o escríbenos.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
@@ -1,63 +1,45 @@
|
||||
<!-- wp:paragraph -->
|
||||
<p>Cada ayuda cuenta. Estas son las formas en las que puedes cambiar la vida de nuestros animales:</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:heading {"anchor":"adopcion"} -->
|
||||
<h2 class="wp-block-heading" id="adopcion">🏡 Adopta</h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Adoptar es la forma más directa de salvar una vida. Consulta los <a href="/adopta/">animales en adopción</a>, ven a conocerlos y te acompañaremos en todo el proceso. Todos se entregan con microchip, vacunados y esterilizados.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:heading {"anchor":"acogida"} -->
|
||||
<h2 class="wp-block-heading" id="acogida">🤝 Casa de acogida</h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Algunos animales necesitan salir del centro cuanto antes: cachorros, mayores o convalecientes. Como casa de acogida les ofreces un hogar temporal mientras encuentran su familia definitiva. Nosotros te orientamos en todo momento.</p>
|
||||
<p>Hay muchas maneras de ayudar a los animales de Bilagun, y todas cuentan.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:heading {"anchor":"voluntariado"} -->
|
||||
<h2 class="wp-block-heading" id="voluntariado">🦮 Voluntariado</h2>
|
||||
<h2 class="wp-block-heading" id="voluntariado">Voluntariado</h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Pasear perros, socializar gatos, ayudar en jornadas de adopción, hacer fotos para las fichas o difundir en redes sociales. Si tienes tiempo y ganas, ¡te necesitamos!</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:heading {"anchor":"donaciones"} -->
|
||||
<h2 class="wp-block-heading" id="donaciones">💚 Donaciones</h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Siempre nos vienen bien:</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:list -->
|
||||
<ul class="wp-block-list"><!-- wp:list-item -->
|
||||
<li>Pienso y latas para perros y gatos</li>
|
||||
<!-- /wp:list-item -->
|
||||
|
||||
<!-- wp:list-item -->
|
||||
<li>Arena para gatos</li>
|
||||
<!-- /wp:list-item -->
|
||||
|
||||
<!-- wp:list-item -->
|
||||
<li>Mantas, toallas y camas</li>
|
||||
<!-- /wp:list-item -->
|
||||
|
||||
<!-- wp:list-item -->
|
||||
<li>Correas, collares, arneses y juguetes</li>
|
||||
<!-- /wp:list-item --></ul>
|
||||
<!-- /wp:list -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Si prefieres hacer una aportación económica, <a href="/contacto/#formulario">escríbenos</a> y te indicamos cómo.</p>
|
||||
<p>Paseos, compañía y socialización de perros y gatos. Si te apetece echarnos una mano, concertamos una primera cita y rellenamos juntos un cuestionario.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:buttons -->
|
||||
<div class="wp-block-buttons"><!-- wp:button -->
|
||||
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="/contacto/#formulario">Quiero colaborar</a></div>
|
||||
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="/contacto/?motivo=voluntario#formulario">Quiero ser voluntario</a></div>
|
||||
<!-- /wp:button --></div>
|
||||
<!-- /wp:buttons -->
|
||||
|
||||
<!-- wp:heading {"anchor":"material"} -->
|
||||
<h2 class="wp-block-heading" id="material">Ayuda material</h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:shortcode -->
|
||||
[ga_necesidades]
|
||||
<!-- /wp:shortcode -->
|
||||
|
||||
<!-- wp:buttons -->
|
||||
<div class="wp-block-buttons"><!-- wp:button -->
|
||||
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="/contacto/?motivo=material#formulario">Escríbenos</a></div>
|
||||
<!-- /wp:button --></div>
|
||||
<!-- /wp:buttons -->
|
||||
|
||||
<!-- wp:heading {"anchor":"compartir"} -->
|
||||
<h2 class="wp-block-heading" id="compartir">Comparte sus historias</h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Si no puedes adoptar, también puedes ayudar compartiendo su historia. Cada ficha tiene su propio enlace para enviarla por WhatsApp o redes.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:buttons -->
|
||||
<div class="wp-block-buttons"><!-- wp:button {"className":"is-style-outline"} -->
|
||||
<div class="wp-block-button is-style-outline"><a class="wp-block-button__link wp-element-button" href="/adopta/">Ver los animales</a></div>
|
||||
<!-- /wp:button --></div>
|
||||
<!-- /wp:buttons -->
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<!-- wp:shortcode -->
|
||||
[ga_cita]
|
||||
<!-- /wp:shortcode -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>📍 <strong>Jaizubia, 44 · 20280 Hondarribia (Gipuzkoa)</strong><br>📞 <a href="tel:+34943645279">943 64 52 79</a><br>✉️ <a href="mailto:hola@gureametsabilagun.org">hola@gureametsabilagun.org</a><br>🕙 Lunes a viernes: 10:00–13:00 y 14:00–19:00</p>
|
||||
<p>Jaizubia, 44 · 20280 Hondarribia (Gipuzkoa)<br><a href="tel:+34943645279">943 64 52 79</a> · <a href="mailto:hola@gureametsabilagun.org">hola@gureametsabilagun.org</a><br>Atención al público: lunes a viernes, 10:00–13:00 y 14:00–19:00</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:heading {"anchor":"formulario"} -->
|
||||
@@ -7,7 +11,7 @@
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Para adopciones, acogidas, voluntariado o reservas del hotel, déjanos tu mensaje y te responderemos lo antes posible.</p>
|
||||
<p>Cuéntanos qué necesitas y te respondemos lo antes posible.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:shortcode -->
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
<!-- wp:paragraph -->
|
||||
<p>¿Planeas unas vacaciones y no puedes llevar a tu compañero? En Gure Ametsa Bi Lagun cuidamos de tu perro o gato mientras estás fuera, en nuestras instalaciones de Jaizubia (Hondarribia), rodeadas de naturaleza.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:heading -->
|
||||
<h2 class="wp-block-heading">Qué ofrecemos</h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:list -->
|
||||
<ul class="wp-block-list"><!-- wp:list-item -->
|
||||
<li>Alojamiento para perros y gatos, por días o temporadas</li>
|
||||
<!-- /wp:list-item -->
|
||||
|
||||
<!-- wp:list-item -->
|
||||
<li>Paseos y atención diaria de personal con experiencia</li>
|
||||
<!-- /wp:list-item -->
|
||||
|
||||
<!-- wp:list-item -->
|
||||
<li>Seguimiento de su alimentación y medicación si la necesita</li>
|
||||
<!-- /wp:list-item --></ul>
|
||||
<!-- /wp:list -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Para reservar es necesario que el animal tenga el microchip y las vacunas al día. Las plazas se llenan en verano y fechas señaladas: reserva con antelación.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:buttons -->
|
||||
<div class="wp-block-buttons"><!-- wp:button -->
|
||||
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="/contacto/#formulario">Consultar disponibilidad</a></div>
|
||||
<!-- /wp:button -->
|
||||
|
||||
<!-- wp:button {"className":"is-style-outline"} -->
|
||||
<div class="wp-block-button is-style-outline"><a class="wp-block-button__link wp-element-button" href="tel:+34943645279">Llamar: 943 64 52 79</a></div>
|
||||
<!-- /wp:button --></div>
|
||||
<!-- /wp:buttons -->
|
||||
39
docker/content/es/preguntas-frecuentes.html
Normal file
39
docker/content/es/preguntas-frecuentes.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<!-- wp:details -->
|
||||
<details class="wp-block-details"><summary>¿Cómo puedo adoptar?</summary><!-- wp:paragraph -->
|
||||
<p>Entra en la ficha del animal que te interese y pulsa «Quiero conocerlo» o «Quiero conocerla». Te enviaremos nuestro cuestionario, lo valoramos con el equipo y quedamos para conoceros. Enviar la solicitud no confirma una adopción.</p>
|
||||
<!-- /wp:paragraph --></details>
|
||||
<!-- /wp:details -->
|
||||
|
||||
<!-- wp:details -->
|
||||
<details class="wp-block-details"><summary>¿Puedo ir directamente a conocer a los animales?</summary><!-- wp:paragraph -->
|
||||
<p>Las visitas son siempre con cita previa. Escríbenos o llámanos y buscamos un momento.</p>
|
||||
<!-- /wp:paragraph --></details>
|
||||
<!-- /wp:details -->
|
||||
|
||||
<!-- wp:details -->
|
||||
<details class="wp-block-details"><summary>¿Qué supone una acogida?</summary><!-- wp:paragraph -->
|
||||
<p>Ofrecer un hogar temporal a un animal mientras encuentra a su familia. La duración, los gastos, el material y el acompañamiento los concretamos contigo en cada caso.</p>
|
||||
<!-- /wp:paragraph --></details>
|
||||
<!-- /wp:details -->
|
||||
|
||||
<!-- wp:details -->
|
||||
<details class="wp-block-details"><summary>¿Cómo puedo hacer voluntariado?</summary><!-- wp:paragraph -->
|
||||
<p>Escríbenos: concertamos una primera cita y rellenamos un cuestionario. Buscamos ayuda con paseos, compañía y socialización.</p>
|
||||
<!-- /wp:paragraph --></details>
|
||||
<!-- /wp:details -->
|
||||
|
||||
<!-- wp:details -->
|
||||
<details class="wp-block-details"><summary>¿Qué material necesitáis?</summary><!-- wp:paragraph -->
|
||||
<p>Tienes la lista actualizada en <a href="/colabora/#material">Colabora</a>. Antes de traer nada, escríbenos para concretar la entrega.</p>
|
||||
<!-- /wp:paragraph --></details>
|
||||
<!-- /wp:details -->
|
||||
|
||||
<!-- wp:details -->
|
||||
<details class="wp-block-details"><summary>¿Puedo adoptar si ya tengo otros animales?</summary><!-- wp:paragraph -->
|
||||
<p>Depende de cada caso. Cuéntanoslo cuando nos escribas y lo valoramos juntos con el equipo.</p>
|
||||
<!-- /wp:paragraph --></details>
|
||||
<!-- /wp:details -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>¿No encuentras tu respuesta? <a href="/contacto/#formulario">Escríbenos</a>.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
@@ -1,43 +1,33 @@
|
||||
<!-- wp:paragraph -->
|
||||
<p><strong>Gure Ametsa Bi Lagun</strong> (en euskera, «nuestro sueño, dos amigos») es un centro de protección y residencia de animales situado en Jaizubia, Hondarribia.</p>
|
||||
<p>Bilagun es la protectora de Jaizubia, en Hondarribia. Desde hace más de 25 años colaboramos con los ayuntamientos de Irun y Hondarribia: cuando aparece un perro o un gato perdido o abandonado, llega a nuestras instalaciones, pasa control veterinario y lo cuidamos hasta que vuelve con su familia o encuentra una nueva.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:heading -->
|
||||
<h2 class="wp-block-heading">Nuestra labor</h2>
|
||||
<h2 class="wp-block-heading">Cómo los cuidamos</h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Trabajamos desde hace más de 25 años con los ayuntamientos de Irun y Hondarribia. Cuando la Policía Municipal encuentra un animal perdido o abandonado en la vía pública, lo trae a nuestras instalaciones. Aquí pasa un control veterinario y permanece alojado y cuidado hasta que vuelve con su familia o encuentra una nueva.</p>
|
||||
<p>Para nosotras cada animal es un individuo, con su historia, sus miedos y su forma de ser. Intentamos conocerlo bien para contar con sinceridad cómo es y qué necesita.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Cumpliendo la Ley de Bienestar Animal, todos los animales reciben los tratamientos necesarios antes de ser adoptados:</p>
|
||||
<p>Antes de la adopción, todos reciben microchip, vacunas, desparasitación y esterilización.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:list -->
|
||||
<ul class="wp-block-list"><!-- wp:list-item -->
|
||||
<li>Identificación con microchip</li>
|
||||
<!-- /wp:list-item -->
|
||||
|
||||
<!-- wp:list-item -->
|
||||
<li>Vacunación y desparasitación</li>
|
||||
<!-- /wp:list-item -->
|
||||
|
||||
<!-- wp:list-item -->
|
||||
<li>Esterilización</li>
|
||||
<!-- /wp:list-item --></ul>
|
||||
<!-- /wp:list -->
|
||||
|
||||
<!-- wp:quote -->
|
||||
<blockquote class="wp-block-quote"><!-- wp:paragraph -->
|
||||
<p>Adopta y cambia dos mundos: el suyo y el tuyo.</p>
|
||||
<!-- /wp:paragraph --></blockquote>
|
||||
<!-- /wp:quote -->
|
||||
|
||||
<!-- wp:heading -->
|
||||
<h2 class="wp-block-heading">¿Has perdido a tu animal?</h2>
|
||||
<h2 class="wp-block-heading">Qué buscamos para ellos</h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Si has perdido a tu perro o gato en Irun u Hondarribia, llámanos cuanto antes al <a href="tel:+34943645279">943 64 52 79</a> y avisa también a la Policía Municipal. Tener el microchip actualizado es la mejor forma de que vuelva a casa.</p>
|
||||
<p>No buscamos familias perfectas, sino familias que encajen con cada animal y respeten su ritmo. Por eso vamos sin prisas: primero nos conocemos y después valoramos juntos.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:buttons -->
|
||||
<div class="wp-block-buttons"><!-- wp:button -->
|
||||
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="/adopta/">Conoce a los animales</a></div>
|
||||
<!-- /wp:button -->
|
||||
|
||||
<!-- wp:button {"className":"is-style-outline"} -->
|
||||
<div class="wp-block-button is-style-outline"><a class="wp-block-button__link wp-element-button" href="/colabora/">Colabora</a></div>
|
||||
<!-- /wp:button --></div>
|
||||
<!-- /wp:buttons -->
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
<!-- wp:shortcode -->
|
||||
[ga_cita]
|
||||
<!-- /wp:shortcode -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>📍 <strong>Jaizubia, 44 · 20280 Hondarribia (Gipuzkoa)</strong><br>📞 <a href="tel:+34943645279">943 64 52 79</a><br>✉️ <a href="mailto:hola@gureametsabilagun.org">hola@gureametsabilagun.org</a><br>🕙 Astelehenetik ostiralera: 10:00–13:00 eta 14:00–19:00</p>
|
||||
<p>Jaizubia, 44 · 20280 Hondarribia (Gipuzkoa)<br><a href="tel:+34943645279">943 64 52 79</a> · <a href="mailto:hola@gureametsabilagun.org">hola@gureametsabilagun.org</a><br>Jendaurreko arreta: astelehenetik ostiralera, 10:00–13:00 eta 14:00–19:00</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:heading {"anchor":"formulario"} -->
|
||||
@@ -7,7 +11,7 @@
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Adopzioak, harrerak, boluntariotza edo hoteleko erreserbak direla eta, utzi zure mezua eta ahalik eta lasterren erantzungo dizugu.</p>
|
||||
<p>Kontaiguzu zer behar duzun eta ahalik eta lasterren erantzungo dizugu.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:shortcode -->
|
||||
|
||||
29
docker/content/eu/harrera.html
Normal file
29
docker/content/eu/harrera.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<!-- wp:paragraph -->
|
||||
<p>Agian orain ezin duzu adoptatu, baina bai etxe bat eskaini denbora batez. Idatzi iezaguzu eta kontatuko dizugu zein animaliak behar duten harrera eta nola lagun dezakezun.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:heading -->
|
||||
<h2 class="wp-block-heading">Zer da harrera-etxe bat?</h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Txakur edo katu batentzako aldi baterako etxea da, bere familia aurkitu bitartean. Batzuek bereziki behar dute: kumeek, animalia zaharrek edo sendatzen ari direnek, babeslekuan baino hobeto baitaude etxe batean.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:heading -->
|
||||
<h2 class="wp-block-heading">Zer dakar?</h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Harrera bakoitza desberdina da. Hasi aurretik zurekin hitz egingo dugu iraupenaz, gastuez, behar den materialaz eta harreran zehar nola lagunduko dizugun.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:buttons -->
|
||||
<div class="wp-block-buttons"><!-- wp:button -->
|
||||
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="/eu/harremanetarako/?motivo=acogida#formulario">Harrera-etxe izan nahi dut</a></div>
|
||||
<!-- /wp:button --></div>
|
||||
<!-- /wp:buttons -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Zalantzarik baduzu? Begiratu <a href="/eu/ohiko-galderak/">ohiko galderak</a> edo idatzi iezaguzu.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
@@ -1,35 +0,0 @@
|
||||
<!-- wp:paragraph -->
|
||||
<p>Oporretara joateko asmoa duzu eta ezin duzu zure laguna eraman? Gure Ametsa Bi Lagunen zure txakurra edo katua zaintzen dugu kanpoan zauden bitartean, Hondarribiko Jaizubian ditugun instalazioetan, naturaz inguratuta.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:heading -->
|
||||
<h2 class="wp-block-heading">Zer eskaintzen dugu</h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:list -->
|
||||
<ul class="wp-block-list"><!-- wp:list-item -->
|
||||
<li>Txakur eta katuentzako ostatua, egunka edo denboraldika</li>
|
||||
<!-- /wp:list-item -->
|
||||
|
||||
<!-- wp:list-item -->
|
||||
<li>Eguneroko ibilaldiak eta esperientziadun langileen arreta</li>
|
||||
<!-- /wp:list-item -->
|
||||
|
||||
<!-- wp:list-item -->
|
||||
<li>Elikaduraren eta, behar izanez gero, botiken jarraipena</li>
|
||||
<!-- /wp:list-item --></ul>
|
||||
<!-- /wp:list -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Erreserba egiteko, animaliak mikrotxipa eta txertoak egunean izan behar ditu. Udan eta data berezietan plazak azkar betetzen dira: egin erreserba aldez aurretik.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:buttons -->
|
||||
<div class="wp-block-buttons"><!-- wp:button -->
|
||||
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="/eu/harremanetarako/#formulario">Galdetu erabilgarritasuna</a></div>
|
||||
<!-- /wp:button -->
|
||||
|
||||
<!-- wp:button {"className":"is-style-outline"} -->
|
||||
<div class="wp-block-button is-style-outline"><a class="wp-block-button__link wp-element-button" href="tel:+34943645279">Deitu: 943 64 52 79</a></div>
|
||||
<!-- /wp:button --></div>
|
||||
<!-- /wp:buttons -->
|
||||
@@ -1,63 +1,45 @@
|
||||
<!-- wp:paragraph -->
|
||||
<p>Laguntza oro da garrantzitsua. Hauek dira gure animalien bizitza aldatzeko moduak:</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:heading {"anchor":"adopcion"} -->
|
||||
<h2 class="wp-block-heading" id="adopcion">🏡 Adoptatu</h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Adoptatzea da bizitza bat salbatzeko modurik zuzenena. Begiratu <a href="/eu/adopta/">adopzioko animaliak</a>, etorri haiek ezagutzera eta prozesu osoan lagunduko dizugu. Guztiak mikrotxiparekin, txertatuta eta antzututa ematen dira.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:heading {"anchor":"acogida"} -->
|
||||
<h2 class="wp-block-heading" id="acogida">🤝 Harrera-etxea</h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Animalia batzuek lehenbailehen irten behar dute zentrotik: kumeek, zaharrek edo gaixorik daudenek. Harrera-etxe gisa, aldi baterako etxe bat eskaintzen diezu behin betiko familia aurkitu bitartean. Guk uneoro bideratuko zaitugu.</p>
|
||||
<p>Bilaguneko animaliei laguntzeko modu asko daude, eta guztiak dira garrantzitsuak.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:heading {"anchor":"voluntariado"} -->
|
||||
<h2 class="wp-block-heading" id="voluntariado">🦮 Boluntariotza</h2>
|
||||
<h2 class="wp-block-heading" id="voluntariado">Boluntariotza</h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Txakurrak paseatu, katuak sozializatu, adopzio-jardunaldietan lagundu, fitxetarako argazkiak atera edo sare sozialetan zabaldu. Denbora eta gogoa badituzu, behar zaitugu!</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:heading {"anchor":"donaciones"} -->
|
||||
<h2 class="wp-block-heading" id="donaciones">💚 Dohaintzak</h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Beti ondo etortzen zaizkigu:</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:list -->
|
||||
<ul class="wp-block-list"><!-- wp:list-item -->
|
||||
<li>Txakur eta katuentzako pentsua eta latak</li>
|
||||
<!-- /wp:list-item -->
|
||||
|
||||
<!-- wp:list-item -->
|
||||
<li>Katuentzako harea</li>
|
||||
<!-- /wp:list-item -->
|
||||
|
||||
<!-- wp:list-item -->
|
||||
<li>Mantak, eskuoihalak eta oheak</li>
|
||||
<!-- /wp:list-item -->
|
||||
|
||||
<!-- wp:list-item -->
|
||||
<li>Uhalak, lepokoak, arneseak eta jostailuak</li>
|
||||
<!-- /wp:list-item --></ul>
|
||||
<!-- /wp:list -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Diru-ekarpen bat egin nahi baduzu, <a href="/eu/harremanetarako/#formulario">idatzi iezaguzu</a> eta nola egin azalduko dizugu.</p>
|
||||
<p>Txakur eta katuekin ibilaldiak, konpainia eta sozializazioa. Esku bat eman nahi badiguzu, lehen hitzordu bat hitzartu eta galdetegi bat beteko dugu elkarrekin.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:buttons -->
|
||||
<div class="wp-block-buttons"><!-- wp:button -->
|
||||
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="/eu/harremanetarako/#formulario">Lagundu nahi dut</a></div>
|
||||
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="/eu/harremanetarako/?motivo=voluntario#formulario">Boluntario izan nahi dut</a></div>
|
||||
<!-- /wp:button --></div>
|
||||
<!-- /wp:buttons -->
|
||||
|
||||
<!-- wp:heading {"anchor":"material"} -->
|
||||
<h2 class="wp-block-heading" id="material">Laguntza materiala</h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:shortcode -->
|
||||
[ga_necesidades]
|
||||
<!-- /wp:shortcode -->
|
||||
|
||||
<!-- wp:buttons -->
|
||||
<div class="wp-block-buttons"><!-- wp:button -->
|
||||
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="/eu/harremanetarako/?motivo=material#formulario">Idatzi iezaguzu</a></div>
|
||||
<!-- /wp:button --></div>
|
||||
<!-- /wp:buttons -->
|
||||
|
||||
<!-- wp:heading {"anchor":"compartir"} -->
|
||||
<h2 class="wp-block-heading" id="compartir">Partekatu haien istorioak</h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Ezin baduzu adoptatu, haren istorioa partekatuz ere lagun dezakezu. Fitxa bakoitzak bere esteka du WhatsApp edo sare sozialen bidez bidaltzeko.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:buttons -->
|
||||
<div class="wp-block-buttons"><!-- wp:button {"className":"is-style-outline"} -->
|
||||
<div class="wp-block-button is-style-outline"><a class="wp-block-button__link wp-element-button" href="/eu/adopta/">Ikusi animaliak</a></div>
|
||||
<!-- /wp:button --></div>
|
||||
<!-- /wp:buttons -->
|
||||
|
||||
@@ -1,43 +1,33 @@
|
||||
<!-- wp:paragraph -->
|
||||
<p><strong>Gure Ametsa Bi Lagun</strong> animaliak babesteko zentro eta egoitza bat da, Hondarribiko Jaizubia auzoan.</p>
|
||||
<p>Bilagun Jaizubiko babeslekua da, Hondarribian. 25 urte baino gehiago daramatzagu Irun eta Hondarribiko udalekin lanean: txakur edo katu bat galduta edo abandonatuta agertzen denean, gure instalazioetara iristen da, albaitari-kontrola egiten zaio eta zaindu egiten dugu bere familiarengana itzuli arte edo familia berri bat aurkitu arte.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:heading -->
|
||||
<h2 class="wp-block-heading">Gure lana</h2>
|
||||
<h2 class="wp-block-heading">Nola zaintzen ditugun</h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>25 urte baino gehiago daramatzagu Irun eta Hondarribiko udalekin lanean. Udaltzaingoak kalean galdutako edo abandonatutako animalia bat aurkitzen duenean, gure instalazioetara ekartzen du. Hemen albaitari-kontrola egiten zaio eta zainduta egoten da bere familiarengana itzuli arte edo familia berri bat aurkitu arte.</p>
|
||||
<p>Guretzat animalia bakoitza norbait da, bere istorio, beldur eta izaerarekin. Ondo ezagutzen saiatzen gara, nolakoa den eta zer behar duen zintzotasunez kontatzeko.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Animalien Ongizaterako Legea betez, animalia guztiek beharrezko tratamenduak jasotzen dituzte adoptatu aurretik:</p>
|
||||
<p>Adoptatu aurretik, guztiek mikrotxipa, txertoak, desparasitazioa eta antzutzea jasotzen dituzte.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:list -->
|
||||
<ul class="wp-block-list"><!-- wp:list-item -->
|
||||
<li>Mikrotxip bidezko identifikazioa</li>
|
||||
<!-- /wp:list-item -->
|
||||
|
||||
<!-- wp:list-item -->
|
||||
<li>Txertaketa eta desparasitazioa</li>
|
||||
<!-- /wp:list-item -->
|
||||
|
||||
<!-- wp:list-item -->
|
||||
<li>Antzutzea</li>
|
||||
<!-- /wp:list-item --></ul>
|
||||
<!-- /wp:list -->
|
||||
|
||||
<!-- wp:quote -->
|
||||
<blockquote class="wp-block-quote"><!-- wp:paragraph -->
|
||||
<p>Adoptatu eta bi mundu aldatu: berea eta zurea.</p>
|
||||
<!-- /wp:paragraph --></blockquote>
|
||||
<!-- /wp:quote -->
|
||||
|
||||
<!-- wp:heading -->
|
||||
<h2 class="wp-block-heading">Zure animalia galdu duzu?</h2>
|
||||
<h2 class="wp-block-heading">Zer bilatzen dugun haientzat</h2>
|
||||
<!-- /wp:heading -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Zure txakurra edo katua Irunen edo Hondarribian galdu baduzu, deitu iezaguzu lehenbailehen <a href="tel:+34943645279">943 64 52 79</a> zenbakira eta jakinarazi Udaltzaingoari ere. Mikrotxipa eguneratuta izatea da etxera itzultzeko modurik onena.</p>
|
||||
<p>Ez dugu familia perfekturik bilatzen, animalia bakoitzarekin bat datozen eta haren erritmoa errespetatzen duten familiak baizik. Horregatik presarik gabe goaz: lehenik elkar ezagutu eta gero elkarrekin baloratzen dugu.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<!-- wp:buttons -->
|
||||
<div class="wp-block-buttons"><!-- wp:button -->
|
||||
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="/eu/adopta/">Ezagutu animaliak</a></div>
|
||||
<!-- /wp:button -->
|
||||
|
||||
<!-- wp:button {"className":"is-style-outline"} -->
|
||||
<div class="wp-block-button is-style-outline"><a class="wp-block-button__link wp-element-button" href="/eu/lagundu/">Lagundu</a></div>
|
||||
<!-- /wp:button --></div>
|
||||
<!-- /wp:buttons -->
|
||||
|
||||
39
docker/content/eu/ohiko-galderak.html
Normal file
39
docker/content/eu/ohiko-galderak.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<!-- wp:details -->
|
||||
<details class="wp-block-details"><summary>Nola adopta dezaket?</summary><!-- wp:paragraph -->
|
||||
<p>Sartu interesatzen zaizun animaliaren fitxan eta sakatu «Ezagutu nahi dut». Gure galdetegia bidaliko dizugu, taldearekin baloratuko dugu eta elkar ezagutzeko geratuko gara. Eskaera bidaltzeak ez du adopzioa baieztatzen.</p>
|
||||
<!-- /wp:paragraph --></details>
|
||||
<!-- /wp:details -->
|
||||
|
||||
<!-- wp:details -->
|
||||
<details class="wp-block-details"><summary>Zuzenean joan naiteke animaliak ezagutzera?</summary><!-- wp:paragraph -->
|
||||
<p>Bisitak beti aurretiko hitzorduarekin dira. Idatzi edo deitu iezaguzu eta une bat bilatuko dugu.</p>
|
||||
<!-- /wp:paragraph --></details>
|
||||
<!-- /wp:details -->
|
||||
|
||||
<!-- wp:details -->
|
||||
<details class="wp-block-details"><summary>Zer dakar harrera batek?</summary><!-- wp:paragraph -->
|
||||
<p>Animalia bati aldi baterako etxe bat eskaintzea, bere familia aurkitu bitartean. Iraupena, gastuak, materiala eta laguntza zurekin zehazten ditugu kasu bakoitzean.</p>
|
||||
<!-- /wp:paragraph --></details>
|
||||
<!-- /wp:details -->
|
||||
|
||||
<!-- wp:details -->
|
||||
<details class="wp-block-details"><summary>Nola egin dezaket boluntariotza?</summary><!-- wp:paragraph -->
|
||||
<p>Idatzi iezaguzu: lehen hitzordu bat hitzartu eta galdetegi bat betetzen dugu. Ibilaldietarako, konpainiarako eta sozializaziorako laguntza bilatzen dugu.</p>
|
||||
<!-- /wp:paragraph --></details>
|
||||
<!-- /wp:details -->
|
||||
|
||||
<!-- wp:details -->
|
||||
<details class="wp-block-details"><summary>Zer material behar duzue?</summary><!-- wp:paragraph -->
|
||||
<p>Zerrenda eguneratua <a href="/eu/lagundu/#material">Lagundu</a> atalean duzu. Ezer ekarri aurretik, idatzi iezaguzu entrega zehazteko.</p>
|
||||
<!-- /wp:paragraph --></details>
|
||||
<!-- /wp:details -->
|
||||
|
||||
<!-- wp:details -->
|
||||
<details class="wp-block-details"><summary>Adopta dezaket beste animaliak baditut?</summary><!-- wp:paragraph -->
|
||||
<p>Kasuaren araberakoa da. Kontaiguzu idazten diguzunean eta elkarrekin baloratuko dugu taldearekin.</p>
|
||||
<!-- /wp:paragraph --></details>
|
||||
<!-- /wp:details -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>Ez duzu zure erantzuna aurkitzen? <a href="/eu/harremanetarako/#formulario">Idatzi iezaguzu</a>.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
@@ -1,45 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
* Contenido inicial bilingüe (castellano / euskera).
|
||||
* Se ejecuta una sola vez con: wp eval-file setup-content.php
|
||||
* Contenido bilingüe (castellano / euskera): idiomas, páginas, especies y menús.
|
||||
*
|
||||
* Idempotente: sirve para la instalación inicial y para las migraciones.
|
||||
* - Las páginas que falten se crean.
|
||||
* - Las páginas existentes solo se actualizan si nadie las ha editado
|
||||
* (se guarda una huella del contenido original en _ga_seed_hash).
|
||||
*
|
||||
* Uso: wp eval-file setup-content.php (GA_SEED_MENUS=true para rehacer los menús)
|
||||
*/
|
||||
|
||||
$src = ( getenv( 'GA_SRC' ) ?: '/usr/src/gure-ametsa' ) . '/content';
|
||||
$pll = function_exists( 'pll_set_post_language' ) && function_exists( 'PLL' );
|
||||
|
||||
if ( ! $pll ) {
|
||||
WP_CLI::warning( 'Polylang no está activo: se crea solo el contenido en castellano.' );
|
||||
WP_CLI::warning( 'Polylang no está activo: se gestiona solo el contenido en castellano.' );
|
||||
}
|
||||
|
||||
/* ---------- 1. Idiomas y ajustes de Polylang ---------- */
|
||||
if ( $pll ) {
|
||||
$model = PLL()->model;
|
||||
$existing = wp_list_pluck( $model->get_languages_list(), 'slug' );
|
||||
$langs = array(
|
||||
foreach ( array(
|
||||
array( 'locale' => 'es_ES', 'slug' => 'es', 'name' => 'Español', 'flag' => 'es', 'term_group' => 0 ),
|
||||
array( 'locale' => 'eu', 'slug' => 'eu', 'name' => 'Euskara', 'flag' => 'basque', 'term_group' => 1 ),
|
||||
);
|
||||
foreach ( $langs as $lang ) {
|
||||
if ( in_array( $lang['slug'], $existing, true ) ) {
|
||||
continue;
|
||||
}
|
||||
$result = $model->add_language( $lang );
|
||||
if ( is_wp_error( $result ) ) {
|
||||
WP_CLI::warning( 'No se pudo crear el idioma ' . $lang['slug'] . ': ' . $result->get_error_message() );
|
||||
) as $lang ) {
|
||||
if ( ! in_array( $lang['slug'], $existing, true ) ) {
|
||||
$result = $model->add_language( $lang );
|
||||
if ( is_wp_error( $result ) ) {
|
||||
WP_CLI::warning( 'No se pudo crear el idioma ' . $lang['slug'] . ': ' . $result->get_error_message() );
|
||||
}
|
||||
}
|
||||
}
|
||||
$model->clean_languages_cache();
|
||||
|
||||
$settings = array(
|
||||
'default_lang' => 'es',
|
||||
'force_lang' => 1, // Idioma en el directorio: /eu/...
|
||||
'hide_default' => true, // Castellano sin prefijo.
|
||||
'rewrite' => true, // /eu/ en lugar de /language/eu/.
|
||||
'redirect_lang' => true, // Portada en euskera en /eu/ (no /eu/hasiera/).
|
||||
'browser' => false,
|
||||
'post_types' => array( 'animal' ),
|
||||
'taxonomies' => array( 'especie' ),
|
||||
'sync' => array( 'taxonomies', 'post_meta', '_thumbnail_id', 'menu_order', 'post_parent' ),
|
||||
'default_lang' => 'es',
|
||||
'force_lang' => 1, // Idioma en el directorio: /eu/...
|
||||
'hide_default' => true, // Castellano sin prefijo.
|
||||
'rewrite' => true, // /eu/ en lugar de /language/eu/.
|
||||
'redirect_lang' => true, // Portada en euskera en /eu/.
|
||||
'browser' => false,
|
||||
'post_types' => array( 'animal' ),
|
||||
'taxonomies' => array( 'especie' ),
|
||||
'sync' => array( 'taxonomies', 'post_meta', '_thumbnail_id', 'menu_order', 'post_parent' ),
|
||||
);
|
||||
$options = PLL()->options;
|
||||
if ( is_object( $options ) && method_exists( $options, 'set' ) ) {
|
||||
@@ -52,7 +56,6 @@ if ( $pll ) {
|
||||
} else {
|
||||
update_option( 'polylang', array_merge( (array) get_option( 'polylang', array() ), $settings ) );
|
||||
}
|
||||
// Traducción al euskera del lema del sitio.
|
||||
if ( class_exists( 'PLL_MO' ) && ( $eu = $model->get_language( 'eu' ) ) ) {
|
||||
$mo = new PLL_MO();
|
||||
$mo->import_from_db( $eu );
|
||||
@@ -62,25 +65,46 @@ if ( $pll ) {
|
||||
if ( class_exists( 'PLL_Admin_Notices' ) ) {
|
||||
PLL_Admin_Notices::dismiss( 'wizard' );
|
||||
}
|
||||
WP_CLI::log( '[ga-setup] Idiomas: castellano (por defecto) y euskera' );
|
||||
}
|
||||
|
||||
/* ---------- 2. Páginas ---------- */
|
||||
function ga_setup_page( $slug, $title, $file, $lang ) {
|
||||
$existing = get_page_by_path( $slug, OBJECT, 'page' );
|
||||
if ( $existing ) {
|
||||
return $existing->ID;
|
||||
|
||||
/** ¿La página sigue con el contenido que pusimos nosotros? */
|
||||
function ga_setup_untouched( WP_Post $post ) {
|
||||
$hash = get_post_meta( $post->ID, '_ga_seed_hash', true );
|
||||
if ( $hash ) {
|
||||
return md5( $post->post_content ) === $hash;
|
||||
}
|
||||
$content = file_get_contents( $file );
|
||||
$id = wp_insert_post( array(
|
||||
'post_type' => 'page',
|
||||
'post_status' => 'publish',
|
||||
'post_title' => $title,
|
||||
'post_name' => $slug,
|
||||
'post_content' => $content,
|
||||
), true );
|
||||
if ( is_wp_error( $id ) ) {
|
||||
WP_CLI::error( "No se pudo crear la página $slug: " . $id->get_error_message() );
|
||||
// Páginas de la primera instalación (sin huella): intactas si nunca se han modificado.
|
||||
return $post->post_modified_gmt === $post->post_date_gmt;
|
||||
}
|
||||
|
||||
function ga_setup_page( $slug, $title, $file, $lang ) {
|
||||
$content = file_exists( $file ) ? file_get_contents( $file ) : '';
|
||||
$page = get_page_by_path( $slug, OBJECT, 'page' );
|
||||
|
||||
if ( $page && 'trash' !== $page->post_status ) {
|
||||
if ( $content && ga_setup_untouched( $page ) && trim( $page->post_content ) !== trim( $content ) ) {
|
||||
wp_update_post( array( 'ID' => $page->ID, 'post_content' => $content, 'post_title' => $title ) );
|
||||
update_post_meta( $page->ID, '_ga_seed_hash', md5( get_post( $page->ID )->post_content ) );
|
||||
WP_CLI::log( "[ga-setup] actualizada: $slug" );
|
||||
} elseif ( ! ga_setup_untouched( $page ) ) {
|
||||
WP_CLI::log( "[ga-setup] se respeta (editada): $slug" );
|
||||
}
|
||||
$id = $page->ID;
|
||||
} else {
|
||||
$id = wp_insert_post( array(
|
||||
'post_type' => 'page',
|
||||
'post_status' => 'publish',
|
||||
'post_title' => $title,
|
||||
'post_name' => $slug,
|
||||
'post_content' => $content,
|
||||
), true );
|
||||
if ( is_wp_error( $id ) ) {
|
||||
WP_CLI::error( "No se pudo crear la página $slug: " . $id->get_error_message() );
|
||||
}
|
||||
update_post_meta( $id, '_ga_seed_hash', md5( get_post( $id )->post_content ) );
|
||||
WP_CLI::log( "[ga-setup] creada: $slug" );
|
||||
}
|
||||
if ( function_exists( 'pll_set_post_language' ) ) {
|
||||
pll_set_post_language( $id, $lang );
|
||||
@@ -88,43 +112,50 @@ function ga_setup_page( $slug, $title, $file, $lang ) {
|
||||
return $id;
|
||||
}
|
||||
|
||||
// slug es => [título es, archivo es, slug eu, título eu, archivo eu]
|
||||
// slug es => [título es, slug eu, título eu]
|
||||
$pages = array(
|
||||
'inicio' => array( 'Inicio', 'inicio', 'hasiera', 'Hasiera', 'hasiera' ),
|
||||
'quienes-somos' => array( 'Quiénes somos', 'quienes-somos', 'nor-gara', 'Nor gara', 'nor-gara' ),
|
||||
'colabora' => array( 'Colabora', 'colabora', 'lagundu', 'Lagundu', 'lagundu' ),
|
||||
'hotel' => array( 'Hotel para perros y gatos', 'hotel', 'hotela', 'Txakur eta katuentzako hotela', 'hotela' ),
|
||||
'contacto' => array( 'Contacto', 'contacto', 'harremanetarako', 'Harremanetarako', 'harremanetarako' ),
|
||||
'politica-de-privacidad' => array( 'Política de privacidad', 'privacidad', 'pribatutasun-politika', 'Pribatutasun-politika', 'pribatutasun-politika' ),
|
||||
'aviso-legal' => array( 'Aviso legal', 'aviso-legal', 'lege-oharra', 'Lege-oharra', 'lege-oharra' ),
|
||||
'inicio' => array( 'Inicio', 'hasiera', 'Hasiera' ),
|
||||
'acoge' => array( 'Acoge', 'harrera', 'Harrera' ),
|
||||
'colabora' => array( 'Colabora', 'lagundu', 'Lagundu' ),
|
||||
'quienes-somos' => array( 'Quiénes somos', 'nor-gara', 'Nor gara' ),
|
||||
'contacto' => array( 'Contacto', 'harremanetarako', 'Harremanetarako' ),
|
||||
'preguntas-frecuentes' => array( 'Preguntas frecuentes', 'ohiko-galderak', 'Ohiko galderak' ),
|
||||
'politica-de-privacidad' => array( 'Política de privacidad', 'pribatutasun-politika', 'Pribatutasun-politika' ),
|
||||
'aviso-legal' => array( 'Aviso legal', 'lege-oharra', 'Lege-oharra' ),
|
||||
);
|
||||
$files = array( 'politica-de-privacidad' => 'privacidad' );
|
||||
|
||||
$ids = array();
|
||||
foreach ( $pages as $slug => [ $title_es, $file_es, $slug_eu, $title_eu, $file_eu ] ) {
|
||||
$ids[ $slug ]['es'] = ga_setup_page( $slug, $title_es, "$src/es/$file_es.html", 'es' );
|
||||
foreach ( $pages as $slug => [ $title_es, $slug_eu, $title_eu ] ) {
|
||||
$ids[ $slug ]['es'] = ga_setup_page( $slug, $title_es, "$src/es/" . ( $files[ $slug ] ?? $slug ) . '.html', 'es' );
|
||||
if ( $pll ) {
|
||||
$ids[ $slug ]['eu'] = ga_setup_page( $slug_eu, $title_eu, "$src/eu/$file_eu.html", 'eu' );
|
||||
$ids[ $slug ]['eu'] = ga_setup_page( $slug_eu, $title_eu, "$src/eu/$slug_eu.html", 'eu' );
|
||||
pll_save_post_translations( $ids[ $slug ] );
|
||||
}
|
||||
}
|
||||
|
||||
// El hotel ya no forma parte de la web: se retira si nadie lo ha editado.
|
||||
foreach ( array( 'hotel', 'hotela' ) as $slug ) {
|
||||
$page = get_page_by_path( $slug, OBJECT, 'page' );
|
||||
if ( $page && 'trash' !== $page->post_status ) {
|
||||
if ( ga_setup_untouched( $page ) ) {
|
||||
wp_trash_post( $page->ID );
|
||||
WP_CLI::log( "[ga-setup] a la papelera: $slug" );
|
||||
} else {
|
||||
WP_CLI::warning( "La página «$slug» se ha editado: no se borra, revísala a mano." );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
update_option( 'show_on_front', 'page' );
|
||||
update_option( 'page_on_front', $ids['inicio']['es'] );
|
||||
update_option( 'wp_page_for_privacy_policy', $ids['politica-de-privacidad']['es'] );
|
||||
WP_CLI::log( '[ga-setup] Páginas creadas' );
|
||||
WP_CLI::log( '[ga-setup] Páginas listas' );
|
||||
|
||||
/* ---------- 3. Especies ---------- */
|
||||
$species = array(
|
||||
'perro' => array( 'Perro', 'txakurra', 'Txakurra' ),
|
||||
'gato' => array( 'Gato', 'katua', 'Katua' ),
|
||||
'otros' => array( 'Otros', 'besteak', 'Besteak' ),
|
||||
);
|
||||
/* ---------- 3. Especies: solo perros y gatos ---------- */
|
||||
$term_ids = array();
|
||||
foreach ( $species as $slug => [ $name_es, $slug_eu, $name_eu ] ) {
|
||||
$pairs = array( 'es' => array( $slug, $name_es ) );
|
||||
if ( $pll ) {
|
||||
$pairs['eu'] = array( $slug_eu, $name_eu );
|
||||
}
|
||||
foreach ( array( 'perro' => array( 'Perro', 'txakurra', 'Txakurra' ), 'gato' => array( 'Gato', 'katua', 'Katua' ) ) as $slug => [ $name_es, $slug_eu, $name_eu ] ) {
|
||||
$pairs = array( 'es' => array( $slug, $name_es ) ) + ( $pll ? array( 'eu' => array( $slug_eu, $name_eu ) ) : array() );
|
||||
foreach ( $pairs as $lang => [ $term_slug, $term_name ] ) {
|
||||
$term = get_term_by( 'slug', $term_slug, 'especie' );
|
||||
if ( ! $term ) {
|
||||
@@ -138,64 +169,95 @@ foreach ( $species as $slug => [ $name_es, $slug_eu, $name_eu ] ) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( $pll && count( $term_ids[ $slug ] ?? array() ) === 2 ) {
|
||||
if ( $pll && 2 === count( $term_ids[ $slug ] ?? array() ) ) {
|
||||
pll_save_term_translations( $term_ids[ $slug ] );
|
||||
}
|
||||
}
|
||||
foreach ( array( 'otros', 'besteak' ) as $slug ) {
|
||||
$term = get_term_by( 'slug', $slug, 'especie' );
|
||||
if ( $term && 0 === (int) $term->count ) {
|
||||
wp_delete_term( $term->term_id, 'especie' );
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------- 4. Menús ---------- */
|
||||
function ga_setup_menu( $name, $items ) {
|
||||
function ga_setup_menu( $name, $items, $rebuild ) {
|
||||
$menu = wp_get_nav_menu_object( $name );
|
||||
if ( $menu ) {
|
||||
if ( $menu && ! $rebuild ) {
|
||||
return $menu->term_id;
|
||||
}
|
||||
if ( $menu ) {
|
||||
wp_delete_nav_menu( $menu->term_id );
|
||||
}
|
||||
$menu_id = wp_create_nav_menu( $name );
|
||||
foreach ( $items as $pos => $item ) {
|
||||
$args = array( 'menu-item-status' => 'publish', 'menu-item-position' => $pos + 1, 'menu-item-title' => $item['title'] );
|
||||
if ( isset( $item['page'] ) ) {
|
||||
$args += array( 'menu-item-type' => 'post_type', 'menu-item-object' => 'page', 'menu-item-object-id' => $item['page'] );
|
||||
} else {
|
||||
$args += array( 'menu-item-type' => 'custom', 'menu-item-url' => $item['url'] );
|
||||
$pos = 0;
|
||||
$add = function ( $item, $parent = 0 ) use ( $menu_id, &$pos, &$add ) {
|
||||
$args = array(
|
||||
'menu-item-status' => 'publish',
|
||||
'menu-item-position' => ++$pos,
|
||||
'menu-item-title' => $item['title'],
|
||||
'menu-item-parent-id' => $parent,
|
||||
);
|
||||
$args += isset( $item['page'] )
|
||||
? array( 'menu-item-type' => 'post_type', 'menu-item-object' => 'page', 'menu-item-object-id' => $item['page'] )
|
||||
: array( 'menu-item-type' => 'custom', 'menu-item-url' => $item['url'] );
|
||||
$id = wp_update_nav_menu_item( $menu_id, 0, $args );
|
||||
foreach ( $item['children'] ?? array() as $child ) {
|
||||
$add( $child, $id );
|
||||
}
|
||||
wp_update_nav_menu_item( $menu_id, 0, $args );
|
||||
};
|
||||
foreach ( $items as $item ) {
|
||||
$add( $item );
|
||||
}
|
||||
return $menu_id;
|
||||
}
|
||||
|
||||
$menus = array(
|
||||
$rebuild = 'true' === getenv( 'GA_SEED_MENUS' );
|
||||
$menus = array(
|
||||
'primary' => array(
|
||||
'es' => ga_setup_menu( 'Principal', array(
|
||||
array( 'title' => 'Adopta', 'url' => '/adopta/' ),
|
||||
array( 'title' => 'Acoge', 'url' => '/colabora/#acogida' ),
|
||||
array( 'title' => 'Voluntariado', 'url' => '/colabora/#voluntariado' ),
|
||||
array( 'title' => 'Dona', 'url' => '/colabora/#donaciones' ),
|
||||
array( 'title' => 'Hotel', 'page' => $ids['hotel']['es'] ),
|
||||
array( 'title' => 'Inicio', 'page' => $ids['inicio']['es'] ),
|
||||
array( 'title' => 'Adopta', 'url' => '/adopta/', 'children' => array(
|
||||
array( 'title' => 'Perros', 'url' => '/especie/perro/' ),
|
||||
array( 'title' => 'Gatos', 'url' => '/especie/gato/' ),
|
||||
) ),
|
||||
array( 'title' => 'Acoge', 'page' => $ids['acoge']['es'] ),
|
||||
array( 'title' => 'Colabora', 'page' => $ids['colabora']['es'], 'children' => array(
|
||||
array( 'title' => 'Voluntariado', 'url' => '/colabora/#voluntariado' ),
|
||||
array( 'title' => 'Ayuda material', 'url' => '/colabora/#material' ),
|
||||
) ),
|
||||
array( 'title' => 'Quiénes somos', 'page' => $ids['quienes-somos']['es'] ),
|
||||
array( 'title' => 'Contacto', 'page' => $ids['contacto']['es'] ),
|
||||
) ),
|
||||
), $rebuild ),
|
||||
),
|
||||
'footer' => array(
|
||||
'es' => ga_setup_menu( 'Legal', array(
|
||||
array( 'title' => 'Aviso legal', 'page' => $ids['aviso-legal']['es'] ),
|
||||
array( 'title' => 'Política de privacidad', 'page' => $ids['politica-de-privacidad']['es'] ),
|
||||
) ),
|
||||
), $rebuild ),
|
||||
),
|
||||
);
|
||||
if ( $pll ) {
|
||||
$menus['primary']['eu'] = ga_setup_menu( 'Nagusia (euskara)', array(
|
||||
array( 'title' => 'Adoptatu', 'url' => '/eu/adopta/' ),
|
||||
array( 'title' => 'Harrera', 'url' => '/eu/lagundu/#acogida' ),
|
||||
array( 'title' => 'Boluntariotza', 'url' => '/eu/lagundu/#voluntariado' ),
|
||||
array( 'title' => 'Dohaintza', 'url' => '/eu/lagundu/#donaciones' ),
|
||||
array( 'title' => 'Hotela', 'page' => $ids['hotel']['eu'] ),
|
||||
array( 'title' => 'Hasiera', 'page' => $ids['inicio']['eu'] ),
|
||||
array( 'title' => 'Adoptatu', 'url' => '/eu/adopta/', 'children' => array(
|
||||
array( 'title' => 'Txakurrak', 'url' => '/eu/especie/txakurra/' ),
|
||||
array( 'title' => 'Katuak', 'url' => '/eu/especie/katua/' ),
|
||||
) ),
|
||||
array( 'title' => 'Harrera', 'page' => $ids['acoge']['eu'] ),
|
||||
array( 'title' => 'Lagundu', 'page' => $ids['colabora']['eu'], 'children' => array(
|
||||
array( 'title' => 'Boluntariotza', 'url' => '/eu/lagundu/#voluntariado' ),
|
||||
array( 'title' => 'Laguntza materiala', 'url' => '/eu/lagundu/#material' ),
|
||||
) ),
|
||||
array( 'title' => 'Nor gara', 'page' => $ids['quienes-somos']['eu'] ),
|
||||
array( 'title' => 'Harremanetarako', 'page' => $ids['contacto']['eu'] ),
|
||||
) );
|
||||
), $rebuild );
|
||||
$menus['footer']['eu'] = ga_setup_menu( 'Legala (euskara)', array(
|
||||
array( 'title' => 'Lege-oharra', 'page' => $ids['aviso-legal']['eu'] ),
|
||||
array( 'title' => 'Pribatutasun-politika', 'page' => $ids['politica-de-privacidad']['eu'] ),
|
||||
) );
|
||||
), $rebuild );
|
||||
|
||||
$theme = get_stylesheet();
|
||||
$nav_menus = array( $theme => $menus );
|
||||
$nav_menus = array( get_stylesheet() => $menus );
|
||||
if ( is_object( PLL()->options ) && method_exists( PLL()->options, 'set' ) ) {
|
||||
PLL()->options->set( 'nav_menus', $nav_menus );
|
||||
if ( method_exists( PLL()->options, 'save_all' ) ) {
|
||||
@@ -207,44 +269,51 @@ if ( $pll ) {
|
||||
update_option( 'polylang', $opts );
|
||||
}
|
||||
}
|
||||
set_theme_mod( 'nav_menu_locations', array(
|
||||
'primary' => $menus['primary']['es'],
|
||||
'footer' => $menus['footer']['es'],
|
||||
) );
|
||||
WP_CLI::log( '[ga-setup] Menús creados' );
|
||||
set_theme_mod( 'nav_menu_locations', array( 'primary' => $menus['primary']['es'], 'footer' => $menus['footer']['es'] ) );
|
||||
WP_CLI::log( '[ga-setup] Menús listos' );
|
||||
|
||||
/* ---------- 5. Animales de ejemplo (opcional) ---------- */
|
||||
if ( 'true' === getenv( 'SEED_DEMO_ANIMALS' ) ) {
|
||||
/* ---------- 5. Animales ---------- */
|
||||
|
||||
// Estados antiguos → nuevos (disponible / proceso / adoptado).
|
||||
foreach ( get_posts( array( 'post_type' => 'animal', 'post_status' => 'any', 'numberposts' => -1, 'fields' => 'ids', 'lang' => '' ) ) as $animal_id ) {
|
||||
$estado = get_post_meta( $animal_id, '_ga_estado', true );
|
||||
$map = array( 'reservado' => 'proceso', 'urgente' => 'disponible', 'acogida' => 'disponible' );
|
||||
if ( isset( $map[ $estado ] ) ) {
|
||||
update_post_meta( $animal_id, '_ga_estado', $map[ $estado ] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( 'true' === getenv( 'SEED_DEMO_ANIMALS' ) && ! get_posts( array( 'post_type' => 'animal', 'numberposts' => 1, 'post_status' => 'any', 'lang' => '' ) ) ) {
|
||||
$demo = array(
|
||||
array(
|
||||
'es' => array( 'Txuri (ejemplo)', 'Txuri es cariñosa, tranquila en casa y le encantan los paseos por Jaizkibel.' ),
|
||||
'eu' => array( 'Txuri (adibidea)', 'Txuri maitekorra da, lasaia etxean, eta Jaizkibelen barrena paseatzea asko gustatzen zaio.' ),
|
||||
'es' => array( 'Txuri (ejemplo)', 'Llegó un poco asustada, pero en cuanto coge confianza no se separa de ti.', array( 'caracter' => 'Tranquila en casa y muy cariñosa con quien conoce. Le encantan los paseos largos.', 'hogar' => 'Una familia que respete su ritmo y le acompañe con paciencia.' ) ),
|
||||
'eu' => array( 'Txuri (adibidea)', 'Beldur pixka batekin iritsi zen, baina konfiantza hartzen duenean ez da zure ondotik aldentzen.', array( 'caracter' => 'Lasaia etxean eta oso maitekorra ezagutzen dituenekin. Ibilaldi luzeak asko gustatzen zaizkio.', 'hogar' => 'Bere erritmoa errespetatu eta pazientziaz lagunduko dion familia bat.' ) ),
|
||||
'sp' => 'perro',
|
||||
'meta' => array( 'sexo' => 'hembra', 'edad' => '3', 'edad_unidad' => 'anos', 'tamano' => 'mediano', 'estado' => 'disponible', 'raza' => 'Mestiza' ),
|
||||
'meta' => array( 'sexo' => 'hembra', 'edad' => '3', 'edad_unidad' => 'anos', 'tamano' => 'mediano', 'estado' => 'disponible', 'destacado' => '1' ),
|
||||
),
|
||||
array(
|
||||
'es' => array( 'Beltza (ejemplo)', 'Beltza es un gato curioso y juguetón que busca un hogar sin prisas.' ),
|
||||
'eu' => array( 'Beltza (adibidea)', 'Beltza katu jakin-nahia eta jostalaria da, eta presarik gabe etxe baten bila dabil.' ),
|
||||
'es' => array( 'Beltza (ejemplo)', 'Curioso y juguetón, siempre quiere saber qué estás haciendo.', array( 'caracter' => 'Muy sociable con las personas. Le gusta jugar y dormir al sol.' ) ),
|
||||
'eu' => array( 'Beltza (adibidea)', 'Jakin-mina eta jostalaria, beti jakin nahi du zer egiten ari zaren.', array( 'caracter' => 'Oso soziala pertsonekin. Jolastea eta eguzkitan lo egitea gustatzen zaizkio.' ) ),
|
||||
'sp' => 'gato',
|
||||
'meta' => array( 'sexo' => 'macho', 'edad' => '1', 'edad_unidad' => 'anos', 'tamano' => 'pequeno', 'estado' => 'disponible', 'raza' => 'Común europeo' ),
|
||||
'meta' => array( 'sexo' => 'macho', 'edad' => '1', 'edad_unidad' => 'anos', 'estado' => 'disponible' ),
|
||||
),
|
||||
array(
|
||||
'es' => array( 'Hartz (ejemplo)', 'Hartz es un abuelito noble que merece pasar sus mejores años en familia.' ),
|
||||
'eu' => array( 'Hartz (adibidea)', 'Hartz aitona noblea da, eta bere urterik onenak familian igarotzea merezi du.' ),
|
||||
'es' => array( 'Hartz (ejemplo)', 'Un abuelito noble que merece pasar sus mejores años en familia.', array( 'necesidades' => 'Paseos tranquilos y una casa sin muchas escaleras.' ) ),
|
||||
'eu' => array( 'Hartz (adibidea)', 'Aitona noblea, bere urterik onenak familian igarotzea merezi duena.', array( 'necesidades' => 'Ibilaldi lasaiak eta eskailera askorik gabeko etxea.' ) ),
|
||||
'sp' => 'perro',
|
||||
'meta' => array( 'sexo' => 'macho', 'edad' => '7', 'edad_unidad' => 'anos', 'tamano' => 'grande', 'estado' => 'urgente', 'raza' => 'Mastín' ),
|
||||
'meta' => array( 'sexo' => 'macho', 'edad' => '9', 'edad_unidad' => 'anos', 'tamano' => 'grande', 'estado' => 'disponible', 'destacado' => '1' ),
|
||||
),
|
||||
array(
|
||||
'es' => array( 'Ilargi (ejemplo)', 'Ilargi es una gatita sociable que se lleva bien con otros gatos.' ),
|
||||
'eu' => array( 'Ilargi (adibidea)', 'Ilargi katakume soziala da eta beste katuekin ondo moldatzen da.' ),
|
||||
'es' => array( 'Ilargi (ejemplo)', 'Una gatita sociable que se lleva bien con otros gatos.', array() ),
|
||||
'eu' => array( 'Ilargi (adibidea)', 'Beste katuekin ondo moldatzen den katakume soziala.', array() ),
|
||||
'sp' => 'gato',
|
||||
'meta' => array( 'sexo' => 'hembra', 'edad' => '4', 'edad_unidad' => 'meses', 'tamano' => 'pequeno', 'estado' => 'reservado', 'raza' => 'Común europeo' ),
|
||||
'meta' => array( 'sexo' => 'hembra', 'edad' => '4', 'edad_unidad' => 'meses', 'estado' => 'proceso' ),
|
||||
),
|
||||
);
|
||||
foreach ( $demo as $animal ) {
|
||||
$translations = array();
|
||||
foreach ( $pll ? array( 'es', 'eu' ) : array( 'es' ) as $lang ) {
|
||||
[ $title, $text ] = $animal[ $lang ];
|
||||
[ $title, $text, $texts ] = $animal[ $lang ];
|
||||
$id = wp_insert_post( array(
|
||||
'post_type' => 'animal',
|
||||
'post_status' => 'publish',
|
||||
@@ -254,7 +323,7 @@ if ( 'true' === getenv( 'SEED_DEMO_ANIMALS' ) ) {
|
||||
if ( ! empty( $term_ids[ $animal['sp'] ][ $lang ] ) ) {
|
||||
wp_set_object_terms( $id, array( $term_ids[ $animal['sp'] ][ $lang ] ), 'especie' );
|
||||
}
|
||||
foreach ( $animal['meta'] + array( 'salud' => 'chip,vacunado,esterilizado', 'compatible' => 'perros,ninos' ) as $key => $value ) {
|
||||
foreach ( $animal['meta'] + $texts as $key => $value ) {
|
||||
update_post_meta( $id, "_ga_$key", $value );
|
||||
}
|
||||
if ( $pll ) {
|
||||
|
||||
@@ -103,7 +103,7 @@ if (( VERSION < 2 )); then
|
||||
wp_ language plugin install polylang es_ES eu 2>/dev/null || true
|
||||
|
||||
# Idiomas, páginas, especies, menús y (opcional) animales de ejemplo
|
||||
if ! wp_ eval-file "$SRC/setup-content.php"; then
|
||||
if ! GA_SEED_MENUS=true wp_ eval-file "$SRC/setup-content.php"; then
|
||||
log "Fallo creando el contenido inicial"
|
||||
exit 1
|
||||
fi
|
||||
@@ -127,7 +127,6 @@ if (( VERSION < 3 )); then
|
||||
instagram-feed # Feed de Instagram
|
||||
koko-analytics # Estadísticas sin cookies
|
||||
kadence-blocks # Bloques visuales: carruseles, pestañas, acordeones…
|
||||
blocks-animation # Animaciones de entrada para cualquier bloque
|
||||
)
|
||||
# Instalados pero desactivados: se activan cuando se necesiten
|
||||
INACTIVE=(
|
||||
@@ -170,4 +169,18 @@ if (( VERSION < 4 )); then
|
||||
wp_ option update ga_setup_version 4
|
||||
fi
|
||||
|
||||
# Etapa 5: indicaciones del cliente (adopción solo Perros/Gatos, fichas nuevas, sin hotel ni donaciones)
|
||||
if (( VERSION < 5 )); then
|
||||
log "Migración 5: páginas, menús y fichas nuevas"
|
||||
# Crea las páginas nuevas, actualiza solo las que nadie ha editado, retira el hotel y rehace los menús
|
||||
if ! GA_SEED_MENUS=true wp_ eval-file "$SRC/setup-content.php"; then
|
||||
log "Fallo en la migración 5"
|
||||
exit 1
|
||||
fi
|
||||
# Sin animaciones que distraigan
|
||||
wp_ plugin deactivate blocks-animation >/dev/null 2>&1 || true
|
||||
wp_ rewrite flush
|
||||
wp_ option update ga_setup_version 5
|
||||
fi
|
||||
|
||||
log "Configuración completada"
|
||||
|
||||
@@ -1,764 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* Plugin Name: Gure Ametsa – Núcleo
|
||||
* Description: Animales en adopción, fichas, listados y formulario de contacto/adopción de Gure Ametsa Bi Lagun. Bilingüe castellano/euskera (con Polylang).
|
||||
* Version: 1.1.0
|
||||
* Plugin Name: Bilagun – Núcleo
|
||||
* Description: Animales en adopción (fichas, galería, vídeo, destacados), formularios de contacto y «Quiero conocerlo», ayuda material, APIs REST/GraphQL. Bilingüe castellano/euskera (con Polylang).
|
||||
* Version: 2.0.0
|
||||
* Author: Gure Ametsa Bi Lagun
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
* Idioma (castellano / euskera)
|
||||
* ---------------------------------------------------------------------- */
|
||||
|
||||
/** Idioma actual: 'es' o 'eu'. El panel de administración siempre en castellano. */
|
||||
function ga_lang() {
|
||||
if ( isset( $GLOBALS['ga_forced_lang'] ) ) {
|
||||
return 'eu' === $GLOBALS['ga_forced_lang'] ? 'eu' : 'es';
|
||||
}
|
||||
if ( is_admin() && ! wp_doing_ajax() ) {
|
||||
return 'es';
|
||||
}
|
||||
$lang = function_exists( 'pll_current_language' ) ? pll_current_language() : '';
|
||||
return 'eu' === $lang ? 'eu' : 'es';
|
||||
}
|
||||
|
||||
/** Devuelve el texto en el idioma actual. */
|
||||
function ga__( $es, $eu ) {
|
||||
return 'eu' === ga_lang() ? $eu : $es;
|
||||
}
|
||||
|
||||
/** Imprime el texto escapado en el idioma actual. */
|
||||
function ga_e( $es, $eu ) {
|
||||
echo esc_html( ga__( $es, $eu ) );
|
||||
}
|
||||
|
||||
/** URL de una página por su slug en castellano, en el idioma actual. */
|
||||
function ga_page_url( $slug_es, $fragment = '' ) {
|
||||
$page = get_page_by_path( $slug_es );
|
||||
if ( ! $page ) {
|
||||
return home_url( "/$slug_es/" ) . $fragment;
|
||||
}
|
||||
$id = $page->ID;
|
||||
if ( function_exists( 'pll_get_post' ) ) {
|
||||
$id = pll_get_post( $id, ga_lang() ) ?: $id;
|
||||
}
|
||||
return get_permalink( $id ) . $fragment;
|
||||
}
|
||||
|
||||
/* Animales y especies son traducibles; los mensajes no. */
|
||||
add_filter( 'pll_get_post_types', function ( $types, $is_settings ) {
|
||||
$types['animal'] = 'animal';
|
||||
unset( $types['ga_mensaje'] );
|
||||
return $types;
|
||||
}, 10, 2 );
|
||||
|
||||
add_filter( 'pll_get_taxonomies', function ( $taxonomies ) {
|
||||
$taxonomies['especie'] = 'especie';
|
||||
return $taxonomies;
|
||||
} );
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
* Datos de la protectora
|
||||
* ---------------------------------------------------------------------- */
|
||||
|
||||
function ga_info( $key = null ) {
|
||||
$info = apply_filters( 'ga_info', array(
|
||||
'nombre' => 'Gure Ametsa Bi Lagun',
|
||||
'direccion' => 'Jaizubia, 44 · 20280 Hondarribia (Gipuzkoa)',
|
||||
'telefono' => '943 64 52 79',
|
||||
'email' => 'hola@gureametsabilagun.org',
|
||||
'horario' => ga__( 'Lunes a viernes: 10:00–13:00 y 14:00–19:00', 'Astelehenetik ostiralera: 10:00–13:00 eta 14:00–19:00' ),
|
||||
'instagram' => 'https://www.instagram.com/gureametsabilagun/',
|
||||
'facebook' => 'https://www.facebook.com/gureametsabilagun/',
|
||||
'maps' => 'https://www.google.com/maps/search/?api=1&query=Jaizubia+44+Hondarribia',
|
||||
) );
|
||||
return $key ? ( $info[ $key ] ?? '' ) : $info;
|
||||
}
|
||||
|
||||
function ga_contact_email() {
|
||||
$email = getenv( 'GA_CONTACT_EMAIL' );
|
||||
return is_email( $email ) ? $email : get_option( 'admin_email' );
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
* Tipos de contenido y taxonomías
|
||||
* ---------------------------------------------------------------------- */
|
||||
|
||||
add_action( 'init', function () {
|
||||
register_post_type( 'animal', array(
|
||||
'labels' => array(
|
||||
'name' => 'Animales',
|
||||
'singular_name' => 'Animal',
|
||||
'add_new' => 'Añadir animal',
|
||||
'add_new_item' => 'Añadir nuevo animal',
|
||||
'edit_item' => 'Editar animal',
|
||||
'new_item' => 'Nuevo animal',
|
||||
'view_item' => 'Ver ficha',
|
||||
'search_items' => 'Buscar animales',
|
||||
'not_found' => 'No hay animales',
|
||||
'not_found_in_trash' => 'No hay animales en la papelera',
|
||||
'all_items' => 'Todos los animales',
|
||||
'featured_image' => 'Foto principal',
|
||||
'set_featured_image' => 'Elegir foto principal',
|
||||
'menu_name' => 'Animales',
|
||||
),
|
||||
'public' => true,
|
||||
'has_archive' => 'adopta',
|
||||
'rewrite' => array( 'slug' => 'adopta', 'with_front' => false ),
|
||||
'menu_icon' => 'dashicons-pets',
|
||||
'menu_position' => 5,
|
||||
'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt' ),
|
||||
'show_in_rest' => true,
|
||||
'rest_base' => 'animales',
|
||||
// WPGraphQL
|
||||
'show_in_graphql' => true,
|
||||
'graphql_single_name' => 'animal',
|
||||
'graphql_plural_name' => 'animales',
|
||||
) );
|
||||
|
||||
register_taxonomy( 'especie', 'animal', array(
|
||||
'labels' => array(
|
||||
'name' => 'Especies',
|
||||
'singular_name' => 'Especie',
|
||||
'add_new_item' => 'Añadir especie',
|
||||
),
|
||||
'hierarchical' => true,
|
||||
'show_admin_column' => true,
|
||||
'show_in_rest' => true,
|
||||
'rest_base' => 'especies',
|
||||
'show_in_graphql' => true,
|
||||
'graphql_single_name' => 'especie',
|
||||
'graphql_plural_name' => 'especies',
|
||||
'rewrite' => array( 'slug' => 'especie', 'with_front' => false ),
|
||||
) );
|
||||
|
||||
register_post_type( 'ga_mensaje', array(
|
||||
'labels' => array(
|
||||
'name' => 'Mensajes',
|
||||
'singular_name' => 'Mensaje',
|
||||
'edit_item' => 'Mensaje',
|
||||
'all_items' => 'Mensajes recibidos',
|
||||
'not_found' => 'Aún no hay mensajes',
|
||||
),
|
||||
'public' => false,
|
||||
'show_ui' => true,
|
||||
'menu_icon' => 'dashicons-email-alt',
|
||||
'menu_position' => 6,
|
||||
'supports' => array( 'title', 'editor' ),
|
||||
'capability_type' => 'post',
|
||||
'capabilities' => array( 'create_posts' => 'do_not_allow' ),
|
||||
'map_meta_cap' => true,
|
||||
) );
|
||||
|
||||
foreach ( array_keys( ga_fields() ) as $key ) {
|
||||
register_post_meta( 'animal', "_ga_$key", array(
|
||||
'type' => 'string',
|
||||
'single' => true,
|
||||
'show_in_rest' => true,
|
||||
'auth_callback' => function () { return current_user_can( 'edit_posts' ); },
|
||||
) );
|
||||
}
|
||||
} );
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
* Campos de la ficha (etiquetas en el idioma actual)
|
||||
* ---------------------------------------------------------------------- */
|
||||
|
||||
function ga_fields() {
|
||||
return array(
|
||||
'estado' => array( 'label' => ga__( 'Estado', 'Egoera' ), 'type' => 'select', 'options' => array(
|
||||
'disponible' => ga__( 'En adopción', 'Adopzioan' ),
|
||||
'urgente' => ga__( 'Adopción urgente', 'Adopzio premiazkoa' ),
|
||||
'acogida' => ga__( 'Busca casa de acogida', 'Harrera-etxe bila' ),
|
||||
'reservado' => ga__( 'Reservado', 'Erreserbatuta' ),
|
||||
'adoptado' => ga__( 'Adoptado', 'Adoptatuta' ),
|
||||
) ),
|
||||
'sexo' => array( 'label' => ga__( 'Sexo', 'Sexua' ), 'type' => 'select', 'options' => array(
|
||||
'macho' => ga__( 'Macho', 'Arra' ),
|
||||
'hembra' => ga__( 'Hembra', 'Emea' ),
|
||||
) ),
|
||||
'edad' => array( 'label' => ga__( 'Edad', 'Adina' ), 'type' => 'number', 'placeholder' => 'p. ej. 2' ),
|
||||
'edad_unidad' => array( 'label' => ga__( 'Edad en', 'Adina' ), 'type' => 'select', 'options' => array(
|
||||
'anos' => ga__( 'Años', 'Urteak' ),
|
||||
'meses' => ga__( 'Meses', 'Hilabeteak' ),
|
||||
) ),
|
||||
'tamano' => array( 'label' => ga__( 'Tamaño', 'Tamaina' ), 'type' => 'select', 'options' => array(
|
||||
'pequeno' => ga__( 'Pequeño', 'Txikia' ),
|
||||
'mediano' => ga__( 'Mediano', 'Ertaina' ),
|
||||
'grande' => ga__( 'Grande', 'Handia' ),
|
||||
) ),
|
||||
'raza' => array( 'label' => ga__( 'Raza', 'Arraza' ), 'type' => 'text', 'placeholder' => 'p. ej. Mestizo' ),
|
||||
'llegada' => array( 'label' => ga__( 'Fecha de llegada', 'Iritsiera-data' ), 'type' => 'date' ),
|
||||
'salud' => array( 'label' => ga__( 'Salud', 'Osasuna' ), 'type' => 'checks', 'options' => array(
|
||||
'chip' => ga__( 'Microchip', 'Mikrotxipa' ),
|
||||
'vacunado' => ga__( 'Vacunado', 'Txertatuta' ),
|
||||
'esterilizado' => ga__( 'Esterilizado', 'Antzututa' ),
|
||||
'desparasitado' => ga__( 'Desparasitado', 'Desparasitatuta' ),
|
||||
) ),
|
||||
'compatible' => array( 'label' => ga__( 'Se lleva bien con', 'Ondo moldatzen da hauekin' ), 'type' => 'checks', 'options' => array(
|
||||
'ninos' => ga__( 'Niños', 'Haurrak' ),
|
||||
'perros' => ga__( 'Perros', 'Txakurrak' ),
|
||||
'gatos' => ga__( 'Gatos', 'Katuak' ),
|
||||
) ),
|
||||
);
|
||||
}
|
||||
|
||||
/** Edad legible en el idioma actual: «3 años», «1 mes», «3 urte», «4 hilabete». */
|
||||
function ga_age( $post_id ) {
|
||||
$n = ga_get( $post_id, 'edad' );
|
||||
if ( '' === $n || ! is_numeric( $n ) ) {
|
||||
return $n; // Valores antiguos en texto libre.
|
||||
}
|
||||
$n = (float) $n + 0;
|
||||
$months = 'meses' === ga_get( $post_id, 'edad_unidad' );
|
||||
if ( 'eu' === ga_lang() ) {
|
||||
return $n . ( $months ? ' hilabete' : ' urte' );
|
||||
}
|
||||
if ( $months ) {
|
||||
return $n . ( 1 == $n ? ' mes' : ' meses' );
|
||||
}
|
||||
return $n . ( 1 == $n ? ' año' : ' años' );
|
||||
}
|
||||
|
||||
function ga_get( $post_id, $key ) {
|
||||
return (string) get_post_meta( $post_id, "_ga_$key", true );
|
||||
}
|
||||
|
||||
/** Etiqueta legible de un campo select, o lista de etiquetas de un campo checks. */
|
||||
function ga_label( $post_id, $key ) {
|
||||
$fields = ga_fields();
|
||||
$value = ga_get( $post_id, $key );
|
||||
if ( '' === $value || ! isset( $fields[ $key ] ) ) {
|
||||
return '';
|
||||
}
|
||||
$field = $fields[ $key ];
|
||||
if ( 'select' === $field['type'] ) {
|
||||
return $field['options'][ $value ] ?? $value;
|
||||
}
|
||||
if ( 'checks' === $field['type'] ) {
|
||||
$labels = array();
|
||||
foreach ( explode( ',', $value ) as $v ) {
|
||||
if ( isset( $field['options'][ $v ] ) ) {
|
||||
$labels[] = $field['options'][ $v ];
|
||||
}
|
||||
}
|
||||
return $labels;
|
||||
}
|
||||
if ( 'date' === $field['type'] ) {
|
||||
return date_i18n( get_option( 'date_format' ), strtotime( $value ) );
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
add_action( 'add_meta_boxes_animal', function () {
|
||||
add_meta_box( 'ga_ficha', 'Ficha del animal', 'ga_render_metabox', 'animal', 'normal', 'high' );
|
||||
} );
|
||||
|
||||
function ga_render_metabox( $post ) {
|
||||
wp_nonce_field( 'ga_ficha', 'ga_ficha_nonce' );
|
||||
echo '<table class="form-table" role="presentation"><tbody>';
|
||||
foreach ( ga_fields() as $key => $f ) {
|
||||
$name = "ga_$key";
|
||||
$value = ga_get( $post->ID, $key );
|
||||
if ( 'estado' === $key && '' === $value ) {
|
||||
$value = 'disponible';
|
||||
}
|
||||
echo '<tr><th scope="row"><label for="' . esc_attr( $name ) . '">' . esc_html( $f['label'] ) . '</label></th><td>';
|
||||
switch ( $f['type'] ) {
|
||||
case 'select':
|
||||
echo '<select id="' . esc_attr( $name ) . '" name="' . esc_attr( $name ) . '"><option value="">—</option>';
|
||||
foreach ( $f['options'] as $v => $l ) {
|
||||
printf( '<option value="%s"%s>%s</option>', esc_attr( $v ), selected( $value, $v, false ), esc_html( $l ) );
|
||||
}
|
||||
echo '</select>';
|
||||
break;
|
||||
case 'checks':
|
||||
$current = array_filter( explode( ',', $value ) );
|
||||
foreach ( $f['options'] as $v => $l ) {
|
||||
printf(
|
||||
'<label style="margin-right:1em"><input type="checkbox" name="%s[]" value="%s"%s> %s</label>',
|
||||
esc_attr( $name ), esc_attr( $v ), checked( in_array( $v, $current, true ), true, false ), esc_html( $l )
|
||||
);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
printf(
|
||||
'<input type="%s" id="%s" name="%s" value="%s" class="%s" placeholder="%s"%s>',
|
||||
esc_attr( $f['type'] ), esc_attr( $name ), esc_attr( $name ), esc_attr( $value ),
|
||||
'number' === $f['type'] ? 'small-text' : 'regular-text',
|
||||
esc_attr( $f['placeholder'] ?? '' ),
|
||||
'number' === $f['type'] ? ' min="0" step="1"' : ''
|
||||
);
|
||||
}
|
||||
echo '</td></tr>';
|
||||
}
|
||||
echo '</tbody></table>';
|
||||
echo '<p class="description">La ficha se comparte entre la versión en castellano y en euskera: al guardar una, se copia a la otra. Solo el nombre y la descripción se traducen.</p>';
|
||||
echo '<p class="description">Consejo: la foto principal aparece en los listados. Añade más fotos en el contenido con el bloque «Galería».</p>';
|
||||
}
|
||||
|
||||
add_action( 'save_post_animal', function ( $post_id ) {
|
||||
if ( ! isset( $_POST['ga_ficha_nonce'] ) || ! wp_verify_nonce( $_POST['ga_ficha_nonce'], 'ga_ficha' ) ) {
|
||||
return;
|
||||
}
|
||||
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE || ! current_user_can( 'edit_post', $post_id ) ) {
|
||||
return;
|
||||
}
|
||||
foreach ( ga_fields() as $key => $f ) {
|
||||
$raw = $_POST[ "ga_$key" ] ?? '';
|
||||
if ( 'checks' === $f['type'] ) {
|
||||
$raw = array_intersect( (array) $raw, array_keys( $f['options'] ) );
|
||||
$value = implode( ',', $raw );
|
||||
} elseif ( 'select' === $f['type'] ) {
|
||||
$value = isset( $f['options'][ $raw ] ) ? $raw : '';
|
||||
} else {
|
||||
$value = sanitize_text_field( wp_unslash( $raw ) );
|
||||
}
|
||||
ga_update_meta_all_languages( $post_id, "_ga_$key", $value );
|
||||
}
|
||||
} );
|
||||
|
||||
/** Guarda un campo en el animal y en todas sus traducciones. */
|
||||
function ga_update_meta_all_languages( $post_id, $meta_key, $value ) {
|
||||
$ids = array( $post_id );
|
||||
if ( function_exists( 'pll_get_post_translations' ) ) {
|
||||
$ids = array_unique( array_merge( $ids, array_values( pll_get_post_translations( $post_id ) ) ) );
|
||||
}
|
||||
foreach ( $ids as $id ) {
|
||||
update_post_meta( $id, $meta_key, $value );
|
||||
}
|
||||
}
|
||||
|
||||
/* Columnas en el listado del admin */
|
||||
add_filter( 'manage_animal_posts_columns', function ( $cols ) {
|
||||
$new = array();
|
||||
foreach ( $cols as $k => $v ) {
|
||||
if ( 'title' === $k ) {
|
||||
$new['ga_foto'] = 'Foto';
|
||||
}
|
||||
$new[ $k ] = $v;
|
||||
if ( 'title' === $k ) {
|
||||
$new['ga_estado'] = 'Estado';
|
||||
$new['ga_edad'] = 'Edad';
|
||||
}
|
||||
}
|
||||
return $new;
|
||||
} );
|
||||
|
||||
add_action( 'manage_animal_posts_custom_column', function ( $col, $post_id ) {
|
||||
if ( 'ga_foto' === $col ) {
|
||||
echo get_the_post_thumbnail( $post_id, array( 60, 60 ) );
|
||||
} elseif ( 'ga_estado' === $col ) {
|
||||
echo esc_html( ga_label( $post_id, 'estado' ) );
|
||||
} elseif ( 'ga_edad' === $col ) {
|
||||
echo esc_html( ga_age( $post_id ) );
|
||||
}
|
||||
}, 10, 2 );
|
||||
|
||||
/* Título de la pestaña del listado en el idioma actual */
|
||||
add_filter( 'document_title_parts', function ( $parts ) {
|
||||
if ( is_post_type_archive( 'animal' ) ) {
|
||||
$parts['title'] = ga__( 'Animales en adopción', 'Animaliak adopzioan' );
|
||||
}
|
||||
return $parts;
|
||||
} );
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
* Consultas del listado público /adopta/
|
||||
* ---------------------------------------------------------------------- */
|
||||
|
||||
add_filter( 'query_vars', function ( $vars ) {
|
||||
return array_merge( $vars, array( 'tamano', 'sexo', 'edad', 'con' ) );
|
||||
} );
|
||||
|
||||
/** Grupos de edad para el filtro del listado. */
|
||||
function ga_age_groups() {
|
||||
return array(
|
||||
'joven' => ga__( 'Menos de 1 año', 'Urtebete baino gutxiago' ),
|
||||
'adulto' => ga__( 'Adulto', 'Heldua' ),
|
||||
'senior' => ga__( 'Mayor (8+)', 'Adinekoa (8+)' ),
|
||||
);
|
||||
}
|
||||
|
||||
/** meta_query para un grupo de edad (la edad se guarda como número + unidad). */
|
||||
function ga_age_meta_query( $group ) {
|
||||
$anos = array( 'key' => '_ga_edad_unidad', 'value' => 'anos' );
|
||||
switch ( $group ) {
|
||||
case 'joven':
|
||||
return array(
|
||||
'relation' => 'OR',
|
||||
array( 'key' => '_ga_edad_unidad', 'value' => 'meses' ),
|
||||
array( 'relation' => 'AND', $anos, array( 'key' => '_ga_edad', 'value' => 1, 'compare' => '<', 'type' => 'NUMERIC' ) ),
|
||||
);
|
||||
case 'adulto':
|
||||
return array( 'relation' => 'AND', $anos, array( 'key' => '_ga_edad', 'value' => array( 1, 7 ), 'compare' => 'BETWEEN', 'type' => 'NUMERIC' ) );
|
||||
case 'senior':
|
||||
return array( 'relation' => 'AND', $anos, array( 'key' => '_ga_edad', 'value' => 8, 'compare' => '>=', 'type' => 'NUMERIC' ) );
|
||||
}
|
||||
return array();
|
||||
}
|
||||
|
||||
function ga_not_adopted_meta_query() {
|
||||
return array(
|
||||
'relation' => 'OR',
|
||||
array( 'key' => '_ga_estado', 'value' => 'adoptado', 'compare' => '!=' ),
|
||||
array( 'key' => '_ga_estado', 'compare' => 'NOT EXISTS' ),
|
||||
);
|
||||
}
|
||||
|
||||
add_action( 'pre_get_posts', function ( $q ) {
|
||||
if ( is_admin() || ! $q->is_main_query() || ! ( $q->is_post_type_archive( 'animal' ) || $q->is_tax( 'especie' ) ) ) {
|
||||
return;
|
||||
}
|
||||
$meta = array( ga_not_adopted_meta_query() );
|
||||
foreach ( array( 'tamano', 'sexo' ) as $key ) {
|
||||
$v = sanitize_key( (string) $q->get( $key ) );
|
||||
if ( $v && isset( ga_fields()[ $key ]['options'][ $v ] ) ) {
|
||||
$meta[] = array( 'key' => "_ga_$key", 'value' => $v );
|
||||
}
|
||||
}
|
||||
$edad = sanitize_key( (string) $q->get( 'edad' ) );
|
||||
if ( isset( ga_age_groups()[ $edad ] ) ) {
|
||||
$meta[] = ga_age_meta_query( $edad );
|
||||
}
|
||||
$con = sanitize_key( (string) $q->get( 'con' ) );
|
||||
if ( isset( ga_fields()['compatible']['options'][ $con ] ) ) {
|
||||
$meta[] = array( 'key' => '_ga_compatible', 'value' => $con, 'compare' => 'LIKE' );
|
||||
}
|
||||
$q->set( 'meta_query', $meta );
|
||||
$q->set( 'posts_per_page', 12 );
|
||||
} );
|
||||
|
||||
/**
|
||||
* Consulta reutilizable de animales (Polylang filtra por el idioma actual).
|
||||
*/
|
||||
function ga_query_animals( $args = array() ) {
|
||||
$args = wp_parse_args( $args, array(
|
||||
'numero' => 6,
|
||||
'especie' => '',
|
||||
'estado' => '',
|
||||
) );
|
||||
|
||||
$query = array(
|
||||
'post_type' => 'animal',
|
||||
'posts_per_page' => (int) $args['numero'],
|
||||
'no_found_rows' => true,
|
||||
);
|
||||
if ( $args['especie'] ) {
|
||||
$query['tax_query'] = array( array(
|
||||
'taxonomy' => 'especie',
|
||||
'field' => 'slug',
|
||||
'terms' => array_map( 'trim', explode( ',', $args['especie'] ) ),
|
||||
) );
|
||||
}
|
||||
if ( $args['estado'] ) {
|
||||
$query['meta_query'] = array( array(
|
||||
'key' => '_ga_estado',
|
||||
'value' => array_map( 'trim', explode( ',', $args['estado'] ) ),
|
||||
'compare' => 'IN',
|
||||
) );
|
||||
} else {
|
||||
$query['meta_query'] = ga_not_adopted_meta_query();
|
||||
}
|
||||
return new WP_Query( $query );
|
||||
}
|
||||
|
||||
/* [ga_animales numero="6" especie="perro" estado="urgente" vista="carrusel"] */
|
||||
add_shortcode( 'ga_animales', function ( $atts ) {
|
||||
$atts = shortcode_atts( array( 'numero' => 6, 'especie' => '', 'estado' => '', 'vista' => 'rejilla' ), $atts, 'ga_animales' );
|
||||
$q = ga_query_animals( $atts );
|
||||
ob_start();
|
||||
if ( $q->have_posts() ) {
|
||||
$carousel = 'carrusel' === $atts['vista'];
|
||||
if ( $carousel ) {
|
||||
ga_carousel_open();
|
||||
} else {
|
||||
echo '<div class="ga-grid">';
|
||||
}
|
||||
while ( $q->have_posts() ) {
|
||||
$q->the_post();
|
||||
ga_animal_card();
|
||||
}
|
||||
$carousel ? ga_carousel_close() : print( '</div>' );
|
||||
} else {
|
||||
echo '<p class="ga-empty">' . esc_html( ga__( 'Ahora mismo no hay animales en esta sección. ¡Vuelve pronto!', 'Une honetan ez dago animaliarik atal honetan. Itzuli laster!' ) ) . '</p>';
|
||||
}
|
||||
wp_reset_postdata();
|
||||
return ob_get_clean();
|
||||
} );
|
||||
|
||||
/** Apertura y cierre de un carrusel accesible (el tema aporta el CSS y el JS). */
|
||||
function ga_carousel_open( $label = '' ) {
|
||||
printf(
|
||||
'<div class="ga-carousel" data-ga-carousel role="region" aria-roledescription="%s" aria-label="%s"><div class="ga-carousel__track" tabindex="0">',
|
||||
esc_attr( ga__( 'carrusel', 'karrusela' ) ),
|
||||
esc_attr( $label ?: ga__( 'Animales', 'Animaliak' ) )
|
||||
);
|
||||
}
|
||||
|
||||
function ga_carousel_close() {
|
||||
printf(
|
||||
'</div><div class="ga-carousel__nav"><button type="button" class="ga-carousel__btn" data-dir="-1" aria-label="%s">←</button><button type="button" class="ga-carousel__btn" data-dir="1" aria-label="%s">→</button></div></div>',
|
||||
esc_attr( ga__( 'Anteriores', 'Aurrekoak' ) ),
|
||||
esc_attr( ga__( 'Siguientes', 'Hurrengoak' ) )
|
||||
);
|
||||
}
|
||||
|
||||
/** Tarjeta de un animal (dentro del loop). El tema puede sobrescribirla con template-parts/animal-card.php. */
|
||||
function ga_animal_card() {
|
||||
if ( locate_template( 'template-parts/animal-card.php' ) ) {
|
||||
get_template_part( 'template-parts/animal-card' );
|
||||
return;
|
||||
}
|
||||
printf( '<article class="ga-card"><a href="%s">%s</a></article>', esc_url( get_permalink() ), esc_html( get_the_title() ) );
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
* Formulario de contacto / solicitud de adopción [ga_contacto]
|
||||
* ---------------------------------------------------------------------- */
|
||||
|
||||
function ga_contact_reasons() {
|
||||
return array(
|
||||
'adopcion' => ga__( 'Adopción', 'Adopzioa' ),
|
||||
'acogida' => ga__( 'Casa de acogida', 'Harrera-etxea' ),
|
||||
'voluntario' => ga__( 'Voluntariado', 'Boluntariotza' ),
|
||||
'donaciones' => ga__( 'Donaciones', 'Dohaintzak' ),
|
||||
'hotel' => ga__( 'Hotel para perros y gatos', 'Txakur eta katuentzako hotela' ),
|
||||
'perdido' => ga__( 'He encontrado / perdido un animal', 'Animalia bat aurkitu / galdu dut' ),
|
||||
'otro' => ga__( 'Otro', 'Beste bat' ),
|
||||
);
|
||||
}
|
||||
|
||||
add_shortcode( 'ga_contacto', function () {
|
||||
$status = isset( $_GET['enviado'] ) ? sanitize_key( $_GET['enviado'] ) : '';
|
||||
$animal_id = isset( $_GET['adoptar'] ) ? absint( $_GET['adoptar'] ) : 0;
|
||||
$animal = $animal_id && 'animal' === get_post_type( $animal_id ) ? get_the_title( $animal_id ) : '';
|
||||
$preselect = $animal ? 'adopcion' : ( isset( $_GET['motivo'] ) ? sanitize_key( $_GET['motivo'] ) : '' );
|
||||
$privacy = ga_page_url( 'politica-de-privacidad' );
|
||||
|
||||
ob_start();
|
||||
if ( 'ok' === $status ) {
|
||||
echo '<div class="ga-notice ga-notice--ok" role="status"><strong>' . esc_html( ga__( '¡Eskerrik asko!', 'Eskerrik asko!' ) ) . '</strong> '
|
||||
. esc_html( ga__( 'Hemos recibido tu mensaje y te responderemos lo antes posible.', 'Zure mezua jaso dugu eta ahalik eta lasterren erantzungo dizugu.' ) ) . '</div>';
|
||||
} elseif ( 'error' === $status ) {
|
||||
echo '<div class="ga-notice ga-notice--error" role="alert">'
|
||||
. esc_html( ga__( 'No hemos podido enviar el mensaje. Revisa los campos obligatorios o escríbenos a ', 'Ezin izan dugu mezua bidali. Egiaztatu derrigorrezko eremuak edo idatzi iezaguzu helbide honetara: ' ) . ga_info( 'email' ) ) . '</div>';
|
||||
}
|
||||
?>
|
||||
<form class="ga-form" method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
|
||||
<input type="hidden" name="action" value="ga_contacto">
|
||||
<input type="hidden" name="idioma" value="<?php echo esc_attr( ga_lang() ); ?>">
|
||||
<input type="hidden" name="redirect" value="<?php echo esc_url( get_permalink() ); ?>">
|
||||
<?php wp_nonce_field( 'ga_contacto', 'ga_nonce' ); ?>
|
||||
<div class="ga-hp" aria-hidden="true"><label>No rellenar <input type="text" name="web" tabindex="-1" autocomplete="off"></label></div>
|
||||
|
||||
<div class="ga-form__row">
|
||||
<label><?php ga_e( 'Nombre', 'Izena' ); ?> *<input type="text" name="nombre" required autocomplete="name"></label>
|
||||
<label><?php ga_e( 'Email', 'Posta elektronikoa' ); ?> *<input type="email" name="email" required autocomplete="email"></label>
|
||||
</div>
|
||||
<div class="ga-form__row">
|
||||
<label><?php ga_e( 'Teléfono', 'Telefonoa' ); ?><input type="tel" name="telefono" autocomplete="tel"></label>
|
||||
<label><?php ga_e( 'Motivo', 'Arrazoia' ); ?>
|
||||
<select name="motivo">
|
||||
<?php foreach ( ga_contact_reasons() as $value => $label ) : ?>
|
||||
<option value="<?php echo esc_attr( $value ); ?>" <?php selected( $preselect, $value ); ?>><?php echo esc_html( $label ); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
<label><?php ga_e( 'Animal por el que preguntas', 'Zein animaliari buruz galdetzen duzu' ); ?>
|
||||
<input type="text" name="animal" value="<?php echo esc_attr( $animal ); ?>" placeholder="<?php echo esc_attr( ga__( 'Opcional', 'Aukerakoa' ) ); ?>">
|
||||
</label>
|
||||
<label><?php ga_e( 'Mensaje', 'Mezua' ); ?> *
|
||||
<textarea name="mensaje" rows="6" required placeholder="<?php echo $animal ? esc_attr( ga__( 'Cuéntanos un poco sobre ti, tu casa y tu día a día…', 'Kontaiguzu zerbait zuri buruz, zure etxeari eta eguneroko bizitzari buruz…' ) ) : ''; ?>"></textarea>
|
||||
</label>
|
||||
<label class="ga-form__check">
|
||||
<input type="checkbox" name="privacidad" value="1" required>
|
||||
<span>
|
||||
<?php if ( 'eu' === ga_lang() ) : ?>
|
||||
<a href="<?php echo esc_url( $privacy ); ?>" target="_blank">Pribatutasun-politika</a> irakurri eta onartzen dut. *
|
||||
<?php else : ?>
|
||||
He leído y acepto la <a href="<?php echo esc_url( $privacy ); ?>" target="_blank">política de privacidad</a>. *
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
</label>
|
||||
<button type="submit" class="ga-btn"><?php ga_e( 'Enviar mensaje', 'Mezua bidali' ); ?></button>
|
||||
</form>
|
||||
<?php
|
||||
return ob_get_clean();
|
||||
} );
|
||||
|
||||
add_action( 'admin_post_nopriv_ga_contacto', 'ga_handle_contact' );
|
||||
add_action( 'admin_post_ga_contacto', 'ga_handle_contact' );
|
||||
|
||||
function ga_handle_contact() {
|
||||
$redirect = wp_validate_redirect( esc_url_raw( wp_unslash( $_POST['redirect'] ?? '' ) ), home_url( '/' ) );
|
||||
$go = function ( $status ) use ( $redirect ) {
|
||||
wp_safe_redirect( add_query_arg( 'enviado', $status, $redirect ) . '#formulario' );
|
||||
exit;
|
||||
};
|
||||
|
||||
if ( ! isset( $_POST['ga_nonce'] ) || ! wp_verify_nonce( $_POST['ga_nonce'], 'ga_contacto' ) ) {
|
||||
$go( 'error' );
|
||||
}
|
||||
// Honeypot: los bots rellenan el campo oculto; fingimos éxito.
|
||||
if ( ! empty( $_POST['web'] ) ) {
|
||||
$go( 'ok' );
|
||||
}
|
||||
|
||||
$reasons = ga_contact_reasons(); // En castellano: el admin_post se ejecuta en contexto de administración.
|
||||
$reason = sanitize_key( $_POST['motivo'] ?? '' );
|
||||
$data = array(
|
||||
'nombre' => sanitize_text_field( wp_unslash( $_POST['nombre'] ?? '' ) ),
|
||||
'email' => sanitize_email( wp_unslash( $_POST['email'] ?? '' ) ),
|
||||
'telefono' => sanitize_text_field( wp_unslash( $_POST['telefono'] ?? '' ) ),
|
||||
'motivo' => $reasons[ $reason ] ?? $reasons['otro'],
|
||||
'animal' => sanitize_text_field( wp_unslash( $_POST['animal'] ?? '' ) ),
|
||||
'mensaje' => sanitize_textarea_field( wp_unslash( $_POST['mensaje'] ?? '' ) ),
|
||||
'idioma' => 'eu' === ( $_POST['idioma'] ?? '' ) ? 'Euskera' : 'Castellano',
|
||||
);
|
||||
if ( ! $data['nombre'] || ! is_email( $data['email'] ) || ! $data['mensaje'] || empty( $_POST['privacidad'] ) ) {
|
||||
$go( 'error' );
|
||||
}
|
||||
|
||||
$subject = sprintf( '[Web] %s – %s', $data['motivo'], $data['nombre'] );
|
||||
if ( $data['animal'] ) {
|
||||
$subject .= ' (' . $data['animal'] . ')';
|
||||
}
|
||||
$body = sprintf(
|
||||
"Nombre: %s\nEmail: %s\nTeléfono: %s\nMotivo: %s\nAnimal: %s\nIdioma: %s\n\n%s",
|
||||
$data['nombre'], $data['email'], $data['telefono'] ?: '-', $data['motivo'], $data['animal'] ?: '-', $data['idioma'], $data['mensaje']
|
||||
);
|
||||
|
||||
// Se guarda siempre en el panel, aunque falle el correo.
|
||||
wp_insert_post( array(
|
||||
'post_type' => 'ga_mensaje',
|
||||
'post_status' => 'private',
|
||||
'post_title' => $subject,
|
||||
'post_content' => $body,
|
||||
) );
|
||||
|
||||
wp_mail( ga_contact_email(), $subject, $body, array( 'Reply-To: ' . $data['nombre'] . ' <' . $data['email'] . '>' ) );
|
||||
|
||||
$go( 'ok' );
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
* APIs: REST (/wp-json/wp/v2/animales) y GraphQL (/graphql)
|
||||
* ---------------------------------------------------------------------- */
|
||||
|
||||
/** Ficha de un animal lista para las APIs: valores internos + textos legibles. */
|
||||
function ga_animal_api_data( $post_id ) {
|
||||
$lang = function_exists( 'pll_get_post_language' ) ? ( pll_get_post_language( $post_id ) ?: 'es' ) : 'es';
|
||||
$list = fn( $key ) => array_values( array_filter( explode( ',', ga_get( $post_id, $key ) ) ) );
|
||||
$data = array(
|
||||
'estado' => ga_get( $post_id, 'estado' ) ?: 'disponible',
|
||||
'sexo' => ga_get( $post_id, 'sexo' ),
|
||||
'edad' => '' === ga_get( $post_id, 'edad' ) ? null : (float) ga_get( $post_id, 'edad' ),
|
||||
'edad_unidad' => ga_get( $post_id, 'edad_unidad' ),
|
||||
'tamano' => ga_get( $post_id, 'tamano' ),
|
||||
'raza' => ga_get( $post_id, 'raza' ),
|
||||
'llegada' => ga_get( $post_id, 'llegada' ),
|
||||
'salud' => $list( 'salud' ),
|
||||
'compatible' => $list( 'compatible' ),
|
||||
'idioma' => $lang,
|
||||
);
|
||||
// Textos legibles en el idioma del animal.
|
||||
$labels = function () use ( $post_id ) {
|
||||
return array(
|
||||
'estado' => ga_label( $post_id, 'estado' ) ?: ga__( 'En adopción', 'Adopzioan' ),
|
||||
'sexo' => ga_label( $post_id, 'sexo' ),
|
||||
'edad' => ga_age( $post_id ),
|
||||
'tamano' => ga_label( $post_id, 'tamano' ),
|
||||
'salud' => ga_label( $post_id, 'salud' ) ?: array(),
|
||||
'compatible' => ga_label( $post_id, 'compatible' ) ?: array(),
|
||||
);
|
||||
};
|
||||
$data['textos'] = ga_with_lang( $lang, $labels );
|
||||
return $data;
|
||||
}
|
||||
|
||||
/** Ejecuta $callback como si el idioma actual fuera $lang (para las etiquetas). */
|
||||
function ga_with_lang( $lang, callable $callback ) {
|
||||
$GLOBALS['ga_forced_lang'] = $lang;
|
||||
try {
|
||||
return $callback();
|
||||
} finally {
|
||||
unset( $GLOBALS['ga_forced_lang'] );
|
||||
}
|
||||
}
|
||||
|
||||
/* REST: campo «ficha» de solo lectura en /wp/v2/animales */
|
||||
add_action( 'rest_api_init', function () {
|
||||
register_rest_field( 'animal', 'ficha', array(
|
||||
'get_callback' => fn( $post ) => ga_animal_api_data( $post['id'] ),
|
||||
'schema' => array(
|
||||
'description' => 'Ficha del animal (valores internos y textos legibles en su idioma).',
|
||||
'type' => 'object',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
'properties' => array(
|
||||
'estado' => array( 'type' => 'string', 'enum' => array( 'disponible', 'urgente', 'acogida', 'reservado', 'adoptado' ) ),
|
||||
'sexo' => array( 'type' => 'string' ),
|
||||
'edad' => array( 'type' => array( 'number', 'null' ) ),
|
||||
'edad_unidad' => array( 'type' => 'string', 'enum' => array( '', 'anos', 'meses' ) ),
|
||||
'tamano' => array( 'type' => 'string' ),
|
||||
'raza' => array( 'type' => 'string' ),
|
||||
'llegada' => array( 'type' => 'string', 'format' => 'date' ),
|
||||
'salud' => array( 'type' => 'array', 'items' => array( 'type' => 'string' ) ),
|
||||
'compatible' => array( 'type' => 'array', 'items' => array( 'type' => 'string' ) ),
|
||||
'idioma' => array( 'type' => 'string' ),
|
||||
'textos' => array( 'type' => 'object' ),
|
||||
),
|
||||
),
|
||||
) );
|
||||
} );
|
||||
|
||||
/* GraphQL: tipo AnimalFicha y campo «ficha» en Animal */
|
||||
add_action( 'graphql_register_types', function () {
|
||||
register_graphql_object_type( 'AnimalFichaTextos', array(
|
||||
'description' => 'Textos legibles de la ficha, en el idioma del animal.',
|
||||
'fields' => array(
|
||||
'estado' => array( 'type' => 'String' ),
|
||||
'sexo' => array( 'type' => 'String' ),
|
||||
'edad' => array( 'type' => 'String' ),
|
||||
'tamano' => array( 'type' => 'String' ),
|
||||
'salud' => array( 'type' => array( 'list_of' => 'String' ) ),
|
||||
'compatible' => array( 'type' => array( 'list_of' => 'String' ) ),
|
||||
),
|
||||
) );
|
||||
register_graphql_object_type( 'AnimalFicha', array(
|
||||
'description' => 'Ficha del animal en adopción.',
|
||||
'fields' => array(
|
||||
'estado' => array( 'type' => 'String', 'description' => 'disponible, urgente, acogida, reservado o adoptado' ),
|
||||
'sexo' => array( 'type' => 'String' ),
|
||||
'edad' => array( 'type' => 'Float' ),
|
||||
'edadUnidad' => array( 'type' => 'String', 'description' => 'anos o meses' ),
|
||||
'tamano' => array( 'type' => 'String' ),
|
||||
'raza' => array( 'type' => 'String' ),
|
||||
'llegada' => array( 'type' => 'String' ),
|
||||
'salud' => array( 'type' => array( 'list_of' => 'String' ) ),
|
||||
'compatible' => array( 'type' => array( 'list_of' => 'String' ) ),
|
||||
'idioma' => array( 'type' => 'String' ),
|
||||
'textos' => array( 'type' => 'AnimalFichaTextos' ),
|
||||
),
|
||||
) );
|
||||
register_graphql_field( 'Animal', 'ficha', array(
|
||||
'type' => 'AnimalFicha',
|
||||
'resolve' => function ( $post ) {
|
||||
$data = ga_animal_api_data( $post->databaseId );
|
||||
$data['edadUnidad'] = $data['edad_unidad'];
|
||||
return $data;
|
||||
},
|
||||
) );
|
||||
} );
|
||||
|
||||
/* Documentación Swagger (/rest-api/docs/): solo para usuarios conectados, salvo API_DOCS_PUBLIC=true */
|
||||
add_action( 'template_redirect', function () {
|
||||
if ( 'docs' === get_query_var( 'swagger_api' ) && 'true' !== getenv( 'API_DOCS_PUBLIC' ) && ! is_user_logged_in() ) {
|
||||
auth_redirect();
|
||||
}
|
||||
}, 1 );
|
||||
|
||||
require_once __DIR__ . '/gure-ametsa/i18n.php';
|
||||
require_once __DIR__ . '/gure-ametsa/animals.php';
|
||||
require_once __DIR__ . '/gure-ametsa/forms.php';
|
||||
require_once __DIR__ . '/gure-ametsa/api.php';
|
||||
|
||||
519
wp-content/mu-plugins/gure-ametsa/animals.php
Normal file
519
wp-content/mu-plugins/gure-ametsa/animals.php
Normal file
@@ -0,0 +1,519 @@
|
||||
<?php
|
||||
/**
|
||||
* Animales en adopción: tipo de contenido, ficha, galería, consultas y listados.
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
* Tipos de contenido y taxonomías
|
||||
* ---------------------------------------------------------------------- */
|
||||
|
||||
add_action( 'init', function () {
|
||||
register_post_type( 'animal', array(
|
||||
'labels' => array(
|
||||
'name' => 'Animales',
|
||||
'singular_name' => 'Animal',
|
||||
'add_new' => 'Añadir animal',
|
||||
'add_new_item' => 'Añadir nuevo animal',
|
||||
'edit_item' => 'Editar animal',
|
||||
'new_item' => 'Nuevo animal',
|
||||
'view_item' => 'Ver ficha',
|
||||
'search_items' => 'Buscar animales',
|
||||
'not_found' => 'No hay animales',
|
||||
'not_found_in_trash' => 'No hay animales en la papelera',
|
||||
'all_items' => 'Todos los animales',
|
||||
'featured_image' => 'Foto principal',
|
||||
'set_featured_image' => 'Elegir foto principal',
|
||||
'remove_featured_image' => 'Quitar foto principal',
|
||||
'use_featured_image' => 'Usar como foto principal',
|
||||
'excerpt' => 'Frase corta',
|
||||
'menu_name' => 'Animales',
|
||||
),
|
||||
'public' => true,
|
||||
'has_archive' => 'adopta',
|
||||
'rewrite' => array( 'slug' => 'adopta', 'with_front' => false ),
|
||||
'menu_icon' => 'dashicons-pets',
|
||||
'menu_position' => 5,
|
||||
'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt' ),
|
||||
'show_in_rest' => true,
|
||||
'rest_base' => 'animales',
|
||||
'show_in_graphql' => true,
|
||||
'graphql_single_name' => 'animal',
|
||||
'graphql_plural_name' => 'animales',
|
||||
) );
|
||||
|
||||
register_taxonomy( 'especie', 'animal', array(
|
||||
'labels' => array(
|
||||
'name' => 'Especies',
|
||||
'singular_name' => 'Especie',
|
||||
'add_new_item' => 'Añadir especie',
|
||||
),
|
||||
'hierarchical' => true,
|
||||
'show_admin_column' => true,
|
||||
'show_in_rest' => true,
|
||||
'rest_base' => 'especies',
|
||||
'show_in_graphql' => true,
|
||||
'graphql_single_name' => 'especie',
|
||||
'graphql_plural_name' => 'especies',
|
||||
'rewrite' => array( 'slug' => 'especie', 'with_front' => false ),
|
||||
) );
|
||||
|
||||
register_post_type( 'ga_mensaje', array(
|
||||
'labels' => array(
|
||||
'name' => 'Mensajes',
|
||||
'singular_name' => 'Mensaje',
|
||||
'edit_item' => 'Mensaje',
|
||||
'all_items' => 'Mensajes recibidos',
|
||||
'not_found' => 'Aún no hay mensajes',
|
||||
),
|
||||
'public' => false,
|
||||
'show_ui' => true,
|
||||
'menu_icon' => 'dashicons-email-alt',
|
||||
'menu_position' => 6,
|
||||
'supports' => array( 'title', 'editor' ),
|
||||
'capability_type' => 'post',
|
||||
'capabilities' => array( 'create_posts' => 'do_not_allow' ),
|
||||
'map_meta_cap' => true,
|
||||
) );
|
||||
|
||||
foreach ( array_keys( ga_fields() ) as $key ) {
|
||||
register_post_meta( 'animal', "_ga_$key", array(
|
||||
'type' => 'string',
|
||||
'single' => true,
|
||||
'show_in_rest' => true,
|
||||
'auth_callback' => fn() => current_user_can( 'edit_posts' ),
|
||||
) );
|
||||
}
|
||||
} );
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
* Campos de la ficha
|
||||
*
|
||||
* 'shared' => true: el dato es común a la versión en castellano y en euskera.
|
||||
* Los textos (carácter, necesidades…) se escriben en cada idioma.
|
||||
* ---------------------------------------------------------------------- */
|
||||
|
||||
function ga_fields() {
|
||||
return array(
|
||||
'estado' => array( 'shared' => true, 'label' => ga__( 'Estado', 'Egoera' ), 'type' => 'select', 'options' => array(
|
||||
'disponible' => ga__( 'Disponible', 'Eskuragarri' ),
|
||||
'proceso' => ga__( 'En proceso', 'Prozesuan' ),
|
||||
'adoptado' => ga__( 'Adoptado', 'Adoptatuta' ),
|
||||
), 'help' => 'Los adoptados salen solos del listado.' ),
|
||||
'destacado' => array( 'shared' => true, 'label' => ga__( 'Destacado', 'Nabarmendua' ), 'type' => 'checkbox', 'help' => 'Aparece en la portada. Útil para quien lleva más tiempo esperando o necesita un hogar especial.' ),
|
||||
'sexo' => array( 'shared' => true, 'label' => ga__( 'Sexo', 'Sexua' ), 'type' => 'select', 'options' => array(
|
||||
'macho' => ga__( 'Macho', 'Arra' ),
|
||||
'hembra' => ga__( 'Hembra', 'Emea' ),
|
||||
) ),
|
||||
'nacimiento' => array( 'shared' => true, 'label' => ga__( 'Fecha de nacimiento', 'Jaiotze-data' ), 'type' => 'date', 'help' => 'Si no se conoce, deja la fecha vacía y rellena la edad aproximada.' ),
|
||||
'edad' => array( 'shared' => true, 'label' => ga__( 'Edad aproximada', 'Gutxi gorabeherako adina' ), 'type' => 'number' ),
|
||||
'edad_unidad' => array( 'shared' => true, 'label' => ga__( 'Edad en', 'Adina' ), 'type' => 'select', 'options' => array(
|
||||
'anos' => ga__( 'Años', 'Urteak' ),
|
||||
'meses' => ga__( 'Meses', 'Hilabeteak' ),
|
||||
) ),
|
||||
'tamano' => array( 'shared' => true, 'label' => ga__( 'Tamaño', 'Tamaina' ), 'type' => 'select', 'options' => array(
|
||||
'pequeno' => ga__( 'Pequeño', 'Txikia' ),
|
||||
'mediano' => ga__( 'Mediano', 'Ertaina' ),
|
||||
'grande' => ga__( 'Grande', 'Handia' ),
|
||||
), 'help' => 'Solo en perros.' ),
|
||||
'llegada' => array( 'shared' => true, 'label' => ga__( 'En Bilagun desde', 'Bilagunen noiztik' ), 'type' => 'date', 'help' => 'Fecha de entrada, solo si está confirmada.' ),
|
||||
'galeria' => array( 'shared' => true, 'label' => ga__( 'Más fotos', 'Argazki gehiago' ), 'type' => 'gallery' ),
|
||||
'video' => array( 'shared' => true, 'label' => ga__( 'Vídeo', 'Bideoa' ), 'type' => 'url', 'help' => 'Enlace de YouTube, Vimeo o Instagram, o un vídeo subido a la biblioteca.' ),
|
||||
|
||||
'caracter' => array( 'label' => ga__( 'Cómo es', 'Nolakoa den' ), 'type' => 'textarea', 'help' => 'Su carácter, contado como en redes.' ),
|
||||
'necesidades' => array( 'label' => ga__( 'Qué necesita', 'Zer behar duen' ), 'type' => 'textarea' ),
|
||||
'convivencia' => array( 'label' => ga__( 'Convivencia con niños y otros animales', 'Haurrekin eta beste animaliekin bizikidetza' ), 'type' => 'textarea', 'help' => 'Solo lo observado, con contexto. Déjalo vacío si no lo sabemos.' ),
|
||||
'hogar' => array( 'label' => ga__( 'El hogar que buscamos', 'Bilatzen dugun etxea' ), 'type' => 'textarea' ),
|
||||
);
|
||||
}
|
||||
|
||||
function ga_get( $post_id, $key ) {
|
||||
return (string) get_post_meta( $post_id, "_ga_$key", true );
|
||||
}
|
||||
|
||||
/** Estado normalizado (acepta valores antiguos). */
|
||||
function ga_status( $post_id ) {
|
||||
$estado = ga_get( $post_id, 'estado' );
|
||||
return match ( $estado ) {
|
||||
'adoptado' => 'adoptado',
|
||||
'proceso', 'reservado' => 'proceso',
|
||||
default => 'disponible',
|
||||
};
|
||||
}
|
||||
|
||||
/** Etiqueta legible de un campo de opciones. */
|
||||
function ga_label( $post_id, $key ) {
|
||||
$fields = ga_fields();
|
||||
$value = 'estado' === $key ? ga_status( $post_id ) : ga_get( $post_id, $key );
|
||||
if ( '' === $value || ! isset( $fields[ $key ] ) ) {
|
||||
return '';
|
||||
}
|
||||
$field = $fields[ $key ];
|
||||
if ( 'select' === $field['type'] ) {
|
||||
return $field['options'][ $value ] ?? '';
|
||||
}
|
||||
if ( 'date' === $field['type'] ) {
|
||||
return date_i18n( get_option( 'date_format' ), strtotime( $value ) );
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
|
||||
/** Edad legible: calculada desde la fecha de nacimiento o la aproximada. */
|
||||
function ga_age( $post_id ) {
|
||||
$birth = ga_get( $post_id, 'nacimiento' );
|
||||
if ( $birth && strtotime( $birth ) ) {
|
||||
$diff = date_diff( date_create( $birth ), date_create( 'today' ) );
|
||||
$n = $diff->y ?: $diff->m;
|
||||
$months = ! $diff->y;
|
||||
if ( ! $n ) {
|
||||
return ga__( 'Menos de un mes', 'Hilabete bat baino gutxiago' );
|
||||
}
|
||||
} else {
|
||||
$n = ga_get( $post_id, 'edad' );
|
||||
if ( '' === $n || ! is_numeric( $n ) ) {
|
||||
return '';
|
||||
}
|
||||
$n = (float) $n + 0;
|
||||
$months = 'meses' === ga_get( $post_id, 'edad_unidad' );
|
||||
}
|
||||
if ( 'eu' === ga_lang() ) {
|
||||
return $n . ( $months ? ' hilabete' : ' urte' );
|
||||
}
|
||||
if ( $months ) {
|
||||
return $n . ( 1 == $n ? ' mes' : ' meses' );
|
||||
}
|
||||
return $n . ( 1 == $n ? ' año' : ' años' );
|
||||
}
|
||||
|
||||
/** ¿Es un perro? (el tamaño solo se muestra en perros) */
|
||||
function ga_is_dog( $post_id ) {
|
||||
$terms = get_the_terms( $post_id, 'especie' ) ?: array();
|
||||
foreach ( $terms as $term ) {
|
||||
if ( in_array( $term->slug, array( 'perro', 'txakurra' ), true ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** IDs de las fotos: la principal primero y después la galería. */
|
||||
function ga_gallery_ids( $post_id ) {
|
||||
$ids = array_filter( array_map( 'absint', explode( ',', ga_get( $post_id, 'galeria' ) ) ) );
|
||||
if ( has_post_thumbnail( $post_id ) ) {
|
||||
array_unshift( $ids, (int) get_post_thumbnail_id( $post_id ) );
|
||||
}
|
||||
return array_values( array_unique( $ids ) );
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
* Ficha en el panel
|
||||
* ---------------------------------------------------------------------- */
|
||||
|
||||
/* Editor clásico para los animales: la historia arriba y la ficha justo debajo, siempre a la vista. */
|
||||
add_filter( 'use_block_editor_for_post_type', fn( $use, $type ) => 'animal' === $type ? false : $use, 10, 2 );
|
||||
|
||||
/* El cuadro de Yoast SEO va al final, debajo de la ficha. */
|
||||
add_filter( 'wpseo_metabox_prio', fn() => 'low' );
|
||||
|
||||
add_action( 'add_meta_boxes_animal', function () {
|
||||
add_meta_box( 'ga_ficha', 'Ficha del animal', 'ga_render_metabox', 'animal', 'normal', 'high' );
|
||||
} );
|
||||
|
||||
function ga_render_metabox( $post ) {
|
||||
wp_nonce_field( 'ga_ficha', 'ga_ficha_nonce' );
|
||||
$fields = ga_fields();
|
||||
$groups = array(
|
||||
'Datos (comunes a castellano y euskera)' => array_filter( $fields, fn( $f ) => ! empty( $f['shared'] ) ),
|
||||
'Textos de la ficha (en el idioma de esta página)' => array_filter( $fields, fn( $f ) => empty( $f['shared'] ) ),
|
||||
);
|
||||
echo '<p class="description">La historia se escribe en el editor principal. La «frase corta» (extracto) es opcional.</p>';
|
||||
foreach ( $groups as $title => $group ) {
|
||||
echo '<h3 style="margin:24px 0 4px">' . esc_html( $title ) . '</h3><table class="form-table" role="presentation"><tbody>';
|
||||
foreach ( $group as $key => $f ) {
|
||||
$name = "ga_$key";
|
||||
$value = 'estado' === $key ? ga_status( $post->ID ) : ga_get( $post->ID, $key );
|
||||
echo '<tr><th scope="row"><label for="' . esc_attr( $name ) . '">' . esc_html( $f['label'] ) . '</label></th><td>';
|
||||
switch ( $f['type'] ) {
|
||||
case 'select':
|
||||
echo '<select id="' . esc_attr( $name ) . '" name="' . esc_attr( $name ) . '">';
|
||||
if ( 'estado' !== $key ) {
|
||||
echo '<option value="">—</option>';
|
||||
}
|
||||
foreach ( $f['options'] as $v => $l ) {
|
||||
printf( '<option value="%s"%s>%s</option>', esc_attr( $v ), selected( $value, $v, false ), esc_html( $l ) );
|
||||
}
|
||||
echo '</select>';
|
||||
break;
|
||||
case 'checkbox':
|
||||
printf( '<label><input type="checkbox" id="%1$s" name="%1$s" value="1"%2$s> Sí</label>', esc_attr( $name ), checked( $value, '1', false ) );
|
||||
break;
|
||||
case 'textarea':
|
||||
printf( '<textarea id="%1$s" name="%1$s" rows="4" class="large-text">%2$s</textarea>', esc_attr( $name ), esc_textarea( $value ) );
|
||||
break;
|
||||
case 'gallery':
|
||||
printf( '<input type="hidden" id="%1$s" name="%1$s" value="%2$s">', esc_attr( $name ), esc_attr( $value ) );
|
||||
echo '<div class="ga-gallery-admin" data-input="' . esc_attr( $name ) . '">';
|
||||
foreach ( array_filter( explode( ',', $value ) ) as $id ) {
|
||||
$thumb = wp_get_attachment_image( (int) $id, array( 80, 80 ) );
|
||||
if ( $thumb ) {
|
||||
printf( '<span class="ga-gallery-admin__item" data-id="%d">%s<button type="button" aria-label="Quitar">×</button></span>', (int) $id, $thumb );
|
||||
}
|
||||
}
|
||||
echo '</div><button type="button" class="button ga-gallery-add">Añadir fotos</button>';
|
||||
break;
|
||||
case 'number':
|
||||
printf( '<input type="number" min="0" step="1" id="%1$s" name="%1$s" value="%2$s" class="small-text">', esc_attr( $name ), esc_attr( $value ) );
|
||||
break;
|
||||
default:
|
||||
printf( '<input type="%1$s" id="%2$s" name="%2$s" value="%3$s" class="regular-text">', esc_attr( $f['type'] ), esc_attr( $name ), esc_attr( $value ) );
|
||||
}
|
||||
if ( ! empty( $f['help'] ) ) {
|
||||
echo '<p class="description">' . esc_html( $f['help'] ) . '</p>';
|
||||
}
|
||||
echo '</td></tr>';
|
||||
}
|
||||
echo '</tbody></table>';
|
||||
}
|
||||
}
|
||||
|
||||
/* Selector de fotos de la galería */
|
||||
add_action( 'admin_enqueue_scripts', function ( $hook ) {
|
||||
if ( ! in_array( $hook, array( 'post.php', 'post-new.php' ), true ) || 'animal' !== get_current_screen()->post_type ) {
|
||||
return;
|
||||
}
|
||||
wp_enqueue_media();
|
||||
wp_add_inline_style( 'wp-admin', '.ga-gallery-admin{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:8px}.ga-gallery-admin__item{position:relative;cursor:move}.ga-gallery-admin__item img{display:block;width:80px;height:80px;object-fit:cover;border-radius:6px}.ga-gallery-admin__item button{position:absolute;top:-6px;right:-6px;width:22px;height:22px;border-radius:50%;border:0;background:#b32d2e;color:#fff;cursor:pointer;line-height:1}' );
|
||||
wp_add_inline_script( 'media-editor', <<<'JS'
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
document.querySelectorAll('.ga-gallery-admin').forEach(function (box) {
|
||||
var input = document.getElementById(box.dataset.input);
|
||||
var sync = function () {
|
||||
input.value = Array.from(box.querySelectorAll('[data-id]')).map(function (el) { return el.dataset.id; }).join(',');
|
||||
};
|
||||
box.addEventListener('click', function (e) {
|
||||
if (e.target.tagName === 'BUTTON') { e.target.parentNode.remove(); sync(); }
|
||||
});
|
||||
box.nextElementSibling.addEventListener('click', function () {
|
||||
var frame = wp.media({ title: 'Fotos del animal', multiple: 'add', library: { type: 'image' }, button: { text: 'Añadir a la ficha' } });
|
||||
frame.on('select', function () {
|
||||
frame.state().get('selection').each(function (att) {
|
||||
if (box.querySelector('[data-id="' + att.id + '"]')) return;
|
||||
var src = (att.get('sizes') && att.get('sizes').thumbnail ? att.get('sizes').thumbnail.url : att.get('url'));
|
||||
var item = document.createElement('span');
|
||||
item.className = 'ga-gallery-admin__item';
|
||||
item.dataset.id = att.id;
|
||||
item.innerHTML = '<img src="' + src + '" alt=""><button type="button" aria-label="Quitar">×</button>';
|
||||
box.appendChild(item);
|
||||
});
|
||||
sync();
|
||||
});
|
||||
frame.open();
|
||||
});
|
||||
});
|
||||
});
|
||||
JS
|
||||
);
|
||||
} );
|
||||
|
||||
add_action( 'save_post_animal', function ( $post_id ) {
|
||||
if ( ! isset( $_POST['ga_ficha_nonce'] ) || ! wp_verify_nonce( $_POST['ga_ficha_nonce'], 'ga_ficha' ) ) {
|
||||
return;
|
||||
}
|
||||
if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || ! current_user_can( 'edit_post', $post_id ) ) {
|
||||
return;
|
||||
}
|
||||
foreach ( ga_fields() as $key => $f ) {
|
||||
$raw = wp_unslash( $_POST[ "ga_$key" ] ?? '' );
|
||||
$value = match ( $f['type'] ) {
|
||||
'select' => isset( $f['options'][ $raw ] ) ? $raw : '',
|
||||
'checkbox' => $raw ? '1' : '',
|
||||
'textarea' => sanitize_textarea_field( $raw ),
|
||||
'gallery' => implode( ',', array_filter( array_map( 'absint', explode( ',', $raw ) ) ) ),
|
||||
'url' => esc_url_raw( $raw ),
|
||||
'number' => '' === $raw ? '' : (string) absint( $raw ),
|
||||
'date' => preg_match( '/^\d{4}-\d{2}-\d{2}$/', $raw ) ? $raw : '',
|
||||
default => sanitize_text_field( $raw ),
|
||||
};
|
||||
if ( ! empty( $f['shared'] ) ) {
|
||||
ga_update_meta_all_languages( $post_id, "_ga_$key", $value );
|
||||
} else {
|
||||
update_post_meta( $post_id, "_ga_$key", $value );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
/** Guarda un campo común en el animal y en todas sus traducciones. */
|
||||
function ga_update_meta_all_languages( $post_id, $meta_key, $value ) {
|
||||
$ids = array( $post_id );
|
||||
if ( function_exists( 'pll_get_post_translations' ) ) {
|
||||
$ids = array_unique( array_merge( $ids, array_values( pll_get_post_translations( $post_id ) ) ) );
|
||||
}
|
||||
foreach ( $ids as $id ) {
|
||||
update_post_meta( $id, $meta_key, $value );
|
||||
}
|
||||
}
|
||||
|
||||
/* Polylang: al crear o sincronizar traducciones, no copiar los textos (se escriben en cada idioma). */
|
||||
add_filter( 'pll_copy_post_metas', function ( $metas, $sync ) {
|
||||
$texts = array_map( fn( $k ) => "_ga_$k", array_keys( array_filter( ga_fields(), fn( $f ) => empty( $f['shared'] ) ) ) );
|
||||
return $sync ? array_values( array_diff( $metas, $texts ) ) : $metas;
|
||||
}, 10, 2 );
|
||||
|
||||
/* Columnas del listado del panel */
|
||||
add_filter( 'manage_animal_posts_columns', function ( $cols ) {
|
||||
$new = array();
|
||||
foreach ( $cols as $k => $v ) {
|
||||
if ( 'title' === $k ) {
|
||||
$new['ga_foto'] = 'Foto';
|
||||
}
|
||||
$new[ $k ] = $v;
|
||||
if ( 'title' === $k ) {
|
||||
$new['ga_estado'] = 'Estado';
|
||||
$new['ga_destacado'] = '★';
|
||||
}
|
||||
}
|
||||
return $new;
|
||||
} );
|
||||
|
||||
add_action( 'manage_animal_posts_custom_column', function ( $col, $post_id ) {
|
||||
if ( 'ga_foto' === $col ) {
|
||||
echo get_the_post_thumbnail( $post_id, array( 60, 60 ) );
|
||||
} elseif ( 'ga_estado' === $col ) {
|
||||
echo esc_html( ga_label( $post_id, 'estado' ) );
|
||||
} elseif ( 'ga_destacado' === $col ) {
|
||||
echo ga_get( $post_id, 'destacado' ) ? '★' : '';
|
||||
}
|
||||
}, 10, 2 );
|
||||
|
||||
/* Título de la pestaña del listado en el idioma actual */
|
||||
add_filter( 'document_title_parts', function ( $parts ) {
|
||||
if ( is_post_type_archive( 'animal' ) ) {
|
||||
$parts['title'] = ga__( 'Adopta', 'Adoptatu' );
|
||||
}
|
||||
return $parts;
|
||||
} );
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
* Consultas
|
||||
* ---------------------------------------------------------------------- */
|
||||
|
||||
/** meta_query de los estados visibles en los listados. */
|
||||
function ga_visible_meta_query() {
|
||||
$hidden = array( 'adoptado' );
|
||||
if ( ! ga_setting( 'adopcion', 'show_in_process', true ) ) {
|
||||
$hidden = array_merge( $hidden, array( 'proceso', 'reservado' ) );
|
||||
}
|
||||
return array(
|
||||
'relation' => 'OR',
|
||||
array( 'key' => '_ga_estado', 'value' => $hidden, 'compare' => 'NOT IN' ),
|
||||
array( 'key' => '_ga_estado', 'compare' => 'NOT EXISTS' ),
|
||||
);
|
||||
}
|
||||
|
||||
/** Orden de los listados según el ajuste «Orden». */
|
||||
function ga_order_args() {
|
||||
return 'antiguos' === ga_setting( 'adopcion', 'order', 'recientes' )
|
||||
? array( 'orderby' => 'date', 'order' => 'ASC' )
|
||||
: array( 'orderby' => 'date', 'order' => 'DESC' );
|
||||
}
|
||||
|
||||
add_action( 'pre_get_posts', function ( $q ) {
|
||||
if ( is_admin() || ! $q->is_main_query() || ! ( $q->is_post_type_archive( 'animal' ) || $q->is_tax( 'especie' ) ) ) {
|
||||
return;
|
||||
}
|
||||
$q->set( 'meta_query', array( ga_visible_meta_query() ) );
|
||||
$q->set( 'posts_per_page', 24 );
|
||||
foreach ( ga_order_args() as $k => $v ) {
|
||||
$q->set( $k, $v );
|
||||
}
|
||||
} );
|
||||
|
||||
/**
|
||||
* Consulta reutilizable de animales (Polylang filtra por el idioma actual).
|
||||
*
|
||||
* @param array $args numero, especie (slugs), estado (lista o 'adoptado'), destacados (bool).
|
||||
*/
|
||||
function ga_query_animals( $args = array() ) {
|
||||
$args = wp_parse_args( $args, array( 'numero' => 6, 'especie' => '', 'estado' => '', 'destacados' => false ) );
|
||||
$query = array(
|
||||
'post_type' => 'animal',
|
||||
'posts_per_page' => (int) $args['numero'],
|
||||
'no_found_rows' => true,
|
||||
) + ga_order_args();
|
||||
|
||||
if ( $args['especie'] ) {
|
||||
$query['tax_query'] = array( array(
|
||||
'taxonomy' => 'especie',
|
||||
'field' => 'slug',
|
||||
'terms' => array_map( 'trim', explode( ',', $args['especie'] ) ),
|
||||
) );
|
||||
}
|
||||
$meta = array();
|
||||
if ( $args['estado'] ) {
|
||||
$meta[] = array( 'key' => '_ga_estado', 'value' => array_map( 'trim', explode( ',', $args['estado'] ) ), 'compare' => 'IN' );
|
||||
} else {
|
||||
$meta[] = ga_visible_meta_query();
|
||||
}
|
||||
if ( $args['destacados'] ) {
|
||||
$meta[] = array( 'key' => '_ga_destacado', 'value' => '1' );
|
||||
}
|
||||
$query['meta_query'] = $meta;
|
||||
|
||||
$q = new WP_Query( $query );
|
||||
// Si no hay destacados marcados, se muestran los que llevan más tiempo esperando.
|
||||
if ( $args['destacados'] && ! $q->have_posts() ) {
|
||||
unset( $query['meta_query'][1] );
|
||||
$query['orderby'] = 'date';
|
||||
$query['order'] = 'ASC';
|
||||
$q = new WP_Query( $query );
|
||||
}
|
||||
return $q;
|
||||
}
|
||||
|
||||
/* [ga_animales numero="6" especie="perro" destacados="1" vista="carrusel"] */
|
||||
add_shortcode( 'ga_animales', function ( $atts ) {
|
||||
$atts = shortcode_atts( array( 'numero' => 6, 'especie' => '', 'estado' => '', 'destacados' => '', 'vista' => 'rejilla' ), $atts, 'ga_animales' );
|
||||
$atts['destacados'] = in_array( $atts['destacados'], array( '1', 'si', 'true' ), true );
|
||||
$q = ga_query_animals( $atts );
|
||||
ob_start();
|
||||
if ( $q->have_posts() ) {
|
||||
$carousel = 'carrusel' === $atts['vista'];
|
||||
$carousel ? ga_carousel_open() : print( '<div class="ga-grid">' );
|
||||
while ( $q->have_posts() ) {
|
||||
$q->the_post();
|
||||
ga_animal_card();
|
||||
}
|
||||
$carousel ? ga_carousel_close() : print( '</div>' );
|
||||
} else {
|
||||
echo '<p class="ga-empty">' . esc_html( ga__( 'Ahora mismo no hay animales en esta sección. ¡Vuelve pronto!', 'Une honetan ez dago animaliarik atal honetan. Itzuli laster!' ) ) . '</p>';
|
||||
}
|
||||
wp_reset_postdata();
|
||||
return ob_get_clean();
|
||||
} );
|
||||
|
||||
/** Apertura y cierre de un carrusel accesible (el tema aporta el CSS y el JS). */
|
||||
function ga_carousel_open( $label = '' ) {
|
||||
printf(
|
||||
'<div class="ga-carousel" data-ga-carousel role="region" aria-roledescription="%s" aria-label="%s"><div class="ga-carousel__track" tabindex="0">',
|
||||
esc_attr( ga__( 'carrusel', 'karrusela' ) ),
|
||||
esc_attr( $label ?: ga__( 'Animales', 'Animaliak' ) )
|
||||
);
|
||||
}
|
||||
|
||||
function ga_carousel_close() {
|
||||
printf(
|
||||
'</div><div class="ga-carousel__nav"><button type="button" class="ga-carousel__btn" data-dir="-1" aria-label="%s">←</button><button type="button" class="ga-carousel__btn" data-dir="1" aria-label="%s">→</button></div></div>',
|
||||
esc_attr( ga__( 'Anteriores', 'Aurrekoak' ) ),
|
||||
esc_attr( ga__( 'Siguientes', 'Hurrengoak' ) )
|
||||
);
|
||||
}
|
||||
|
||||
/** Tarjeta de un animal (dentro del loop). El tema la define en template-parts/animal-card.php. */
|
||||
function ga_animal_card() {
|
||||
if ( locate_template( 'template-parts/animal-card.php' ) ) {
|
||||
get_template_part( 'template-parts/animal-card' );
|
||||
return;
|
||||
}
|
||||
printf( '<article class="ga-card"><a href="%s">%s</a></article>', esc_url( get_permalink() ), esc_html( get_the_title() ) );
|
||||
}
|
||||
113
wp-content/mu-plugins/gure-ametsa/api.php
Normal file
113
wp-content/mu-plugins/gure-ametsa/api.php
Normal file
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
/**
|
||||
* APIs: REST (/wp-json/wp/v2/animales) y GraphQL (/graphql). Documentación Swagger protegida.
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/** Ficha de un animal lista para las APIs: valores internos + textos legibles en su idioma. */
|
||||
function ga_animal_api_data( $post_id ) {
|
||||
$lang = function_exists( 'pll_get_post_language' ) ? ( pll_get_post_language( $post_id ) ?: 'es' ) : 'es';
|
||||
$data = array(
|
||||
'estado' => ga_status( $post_id ),
|
||||
'destacado' => (bool) ga_get( $post_id, 'destacado' ),
|
||||
'sexo' => ga_get( $post_id, 'sexo' ),
|
||||
'nacimiento' => ga_get( $post_id, 'nacimiento' ),
|
||||
'edad' => '' === ga_get( $post_id, 'edad' ) ? null : (float) ga_get( $post_id, 'edad' ),
|
||||
'edad_unidad' => ga_get( $post_id, 'edad_unidad' ),
|
||||
'tamano' => ga_get( $post_id, 'tamano' ),
|
||||
'llegada' => ga_get( $post_id, 'llegada' ),
|
||||
'galeria' => array_map( fn( $id ) => wp_get_attachment_image_url( $id, 'large' ), ga_gallery_ids( $post_id ) ),
|
||||
'video' => ga_get( $post_id, 'video' ),
|
||||
'caracter' => ga_get( $post_id, 'caracter' ),
|
||||
'necesidades' => ga_get( $post_id, 'necesidades' ),
|
||||
'convivencia' => ga_get( $post_id, 'convivencia' ),
|
||||
'hogar' => ga_get( $post_id, 'hogar' ),
|
||||
'idioma' => $lang,
|
||||
);
|
||||
$data['textos'] = ga_with_lang( $lang, fn() => array(
|
||||
'estado' => ga_label( $post_id, 'estado' ),
|
||||
'sexo' => ga_label( $post_id, 'sexo' ),
|
||||
'edad' => ga_age( $post_id ),
|
||||
'tamano' => ga_label( $post_id, 'tamano' ),
|
||||
) );
|
||||
return $data;
|
||||
}
|
||||
|
||||
add_action( 'rest_api_init', function () {
|
||||
register_rest_field( 'animal', 'ficha', array(
|
||||
'get_callback' => fn( $post ) => ga_animal_api_data( $post['id'] ),
|
||||
'schema' => array(
|
||||
'description' => 'Ficha del animal (valores internos y textos legibles en su idioma).',
|
||||
'type' => 'object',
|
||||
'context' => array( 'view', 'edit' ),
|
||||
'readonly' => true,
|
||||
'properties' => array(
|
||||
'estado' => array( 'type' => 'string', 'enum' => array( 'disponible', 'proceso', 'adoptado' ) ),
|
||||
'destacado' => array( 'type' => 'boolean' ),
|
||||
'sexo' => array( 'type' => 'string' ),
|
||||
'nacimiento' => array( 'type' => 'string' ),
|
||||
'edad' => array( 'type' => array( 'number', 'null' ) ),
|
||||
'edad_unidad' => array( 'type' => 'string' ),
|
||||
'tamano' => array( 'type' => 'string' ),
|
||||
'llegada' => array( 'type' => 'string' ),
|
||||
'galeria' => array( 'type' => 'array', 'items' => array( 'type' => 'string', 'format' => 'uri' ) ),
|
||||
'video' => array( 'type' => 'string' ),
|
||||
'caracter' => array( 'type' => 'string' ),
|
||||
'necesidades' => array( 'type' => 'string' ),
|
||||
'convivencia' => array( 'type' => 'string' ),
|
||||
'hogar' => array( 'type' => 'string' ),
|
||||
'idioma' => array( 'type' => 'string' ),
|
||||
'textos' => array( 'type' => 'object' ),
|
||||
),
|
||||
),
|
||||
) );
|
||||
} );
|
||||
|
||||
add_action( 'graphql_register_types', function () {
|
||||
register_graphql_object_type( 'AnimalFichaTextos', array(
|
||||
'description' => 'Textos legibles de la ficha, en el idioma del animal.',
|
||||
'fields' => array(
|
||||
'estado' => array( 'type' => 'String' ),
|
||||
'sexo' => array( 'type' => 'String' ),
|
||||
'edad' => array( 'type' => 'String' ),
|
||||
'tamano' => array( 'type' => 'String' ),
|
||||
),
|
||||
) );
|
||||
register_graphql_object_type( 'AnimalFicha', array(
|
||||
'description' => 'Ficha del animal en adopción.',
|
||||
'fields' => array(
|
||||
'estado' => array( 'type' => 'String', 'description' => 'disponible, proceso o adoptado' ),
|
||||
'destacado' => array( 'type' => 'Boolean' ),
|
||||
'sexo' => array( 'type' => 'String' ),
|
||||
'nacimiento' => array( 'type' => 'String' ),
|
||||
'edad' => array( 'type' => 'Float' ),
|
||||
'edadUnidad' => array( 'type' => 'String' ),
|
||||
'tamano' => array( 'type' => 'String' ),
|
||||
'llegada' => array( 'type' => 'String' ),
|
||||
'galeria' => array( 'type' => array( 'list_of' => 'String' ) ),
|
||||
'video' => array( 'type' => 'String' ),
|
||||
'caracter' => array( 'type' => 'String' ),
|
||||
'necesidades' => array( 'type' => 'String' ),
|
||||
'convivencia' => array( 'type' => 'String' ),
|
||||
'hogar' => array( 'type' => 'String' ),
|
||||
'idioma' => array( 'type' => 'String' ),
|
||||
'textos' => array( 'type' => 'AnimalFichaTextos' ),
|
||||
),
|
||||
) );
|
||||
register_graphql_field( 'Animal', 'ficha', array(
|
||||
'type' => 'AnimalFicha',
|
||||
'resolve' => function ( $post ) {
|
||||
$data = ga_animal_api_data( $post->databaseId );
|
||||
$data['edadUnidad'] = $data['edad_unidad'];
|
||||
return $data;
|
||||
},
|
||||
) );
|
||||
} );
|
||||
|
||||
/* Documentación Swagger (/rest-api/docs/): solo para usuarios conectados, salvo API_DOCS_PUBLIC=true */
|
||||
add_action( 'template_redirect', function () {
|
||||
if ( 'docs' === get_query_var( 'swagger_api' ) && 'true' !== getenv( 'API_DOCS_PUBLIC' ) && ! is_user_logged_in() ) {
|
||||
auth_redirect();
|
||||
}
|
||||
}, 1 );
|
||||
178
wp-content/mu-plugins/gure-ametsa/forms.php
Normal file
178
wp-content/mu-plugins/gure-ametsa/forms.php
Normal file
@@ -0,0 +1,178 @@
|
||||
<?php
|
||||
/**
|
||||
* Formularios (contacto general y «Quiero conocerlo/la»), ayuda material y cita previa.
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/** Motivos del formulario general. */
|
||||
function ga_contact_reasons() {
|
||||
return array(
|
||||
'adopcion' => ga__( 'Adopción', 'Adopzioa' ),
|
||||
'acogida' => ga__( 'Casa de acogida', 'Harrera-etxea' ),
|
||||
'voluntario' => ga__( 'Voluntariado', 'Boluntariotza' ),
|
||||
'material' => ga__( 'Ayuda material', 'Laguntza materiala' ),
|
||||
'otro' => ga__( 'Otro', 'Beste bat' ),
|
||||
);
|
||||
}
|
||||
|
||||
/** Texto de confirmación tras enviar. */
|
||||
function ga_confirmation_text( $is_animal ) {
|
||||
return $is_animal
|
||||
? ga_setting( 'adopcion', 'confirm', ga__( 'Hemos recibido tu solicitud. Nos pondremos en contacto contigo para enviarte nuestro cuestionario y conoceros un poquito mejor.', 'Zure eskaera jaso dugu. Zurekin harremanetan jarriko gara gure galdetegia bidaltzeko eta elkar hobeto ezagutzeko.' ) )
|
||||
: ga_setting( 'adopcion', 'confirm_contact', ga__( '¡Gracias! Hemos recibido tu mensaje y te responderemos lo antes posible.', 'Eskerrik asko! Zure mezua jaso dugu eta ahalik eta lasterren erantzungo dizugu.' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* [ga_contacto] formulario general.
|
||||
* [ga_contacto animal="123"] formulario breve «Quiero conocerlo/la» (el animal va incluido).
|
||||
*/
|
||||
add_shortcode( 'ga_contacto', function ( $atts ) {
|
||||
$atts = shortcode_atts( array( 'animal' => 0 ), $atts, 'ga_contacto' );
|
||||
$animal_id = absint( $atts['animal'] ) ?: absint( $_GET['adoptar'] ?? 0 );
|
||||
$animal_id = $animal_id && 'animal' === get_post_type( $animal_id ) ? $animal_id : 0;
|
||||
$is_animal = absint( $atts['animal'] ) > 0; // Formulario breve dentro de la ficha.
|
||||
$status = sanitize_key( $_GET['enviado'] ?? '' );
|
||||
$preselect = $animal_id ? 'adopcion' : sanitize_key( $_GET['motivo'] ?? '' );
|
||||
$privacy = ga_page_url( 'politica-de-privacidad' );
|
||||
$anchor = $is_animal ? 'conocer' : 'formulario';
|
||||
|
||||
ob_start();
|
||||
if ( 'ok' === $status ) {
|
||||
echo '<div class="ga-notice ga-notice--ok" role="status">' . esc_html( ga_confirmation_text( (bool) $animal_id ) ) . '</div>';
|
||||
if ( $is_animal ) {
|
||||
return ob_get_clean();
|
||||
}
|
||||
} elseif ( 'error' === $status ) {
|
||||
echo '<div class="ga-notice ga-notice--error" role="alert">'
|
||||
. esc_html( ga__( 'No hemos podido enviar el mensaje. Revisa los campos obligatorios o escríbenos a ', 'Ezin izan dugu mezua bidali. Egiaztatu derrigorrezko eremuak edo idatzi iezaguzu helbide honetara: ' ) . ga_info( 'email' ) ) . '</div>';
|
||||
}
|
||||
?>
|
||||
<form class="ga-form" method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
|
||||
<input type="hidden" name="action" value="ga_contacto">
|
||||
<input type="hidden" name="idioma" value="<?php echo esc_attr( ga_lang() ); ?>">
|
||||
<input type="hidden" name="redirect" value="<?php echo esc_url( get_permalink() . '#' . $anchor ); ?>">
|
||||
<?php if ( $animal_id ) : ?>
|
||||
<input type="hidden" name="animal_id" value="<?php echo (int) $animal_id; ?>">
|
||||
<?php endif; ?>
|
||||
<?php wp_nonce_field( 'ga_contacto', 'ga_nonce' ); ?>
|
||||
<div class="ga-hp" aria-hidden="true"><label>No rellenar <input type="text" name="web" tabindex="-1" autocomplete="off"></label></div>
|
||||
|
||||
<div class="ga-form__row">
|
||||
<label><?php ga_e( 'Nombre', 'Izena' ); ?> *<input type="text" name="nombre" required autocomplete="name"></label>
|
||||
<label><?php ga_e( 'Correo electrónico', 'Posta elektronikoa' ); ?> *<input type="email" name="email" required autocomplete="email"></label>
|
||||
</div>
|
||||
<div class="ga-form__row">
|
||||
<label><?php ga_e( 'Teléfono', 'Telefonoa' ); ?><?php echo $is_animal ? ' *' : ''; ?><input type="tel" name="telefono" autocomplete="tel"<?php echo $is_animal ? ' required' : ''; ?>></label>
|
||||
<?php if ( ! $is_animal ) : ?>
|
||||
<label><?php ga_e( 'Motivo', 'Arrazoia' ); ?>
|
||||
<select name="motivo">
|
||||
<?php foreach ( ga_contact_reasons() as $value => $label ) : ?>
|
||||
<option value="<?php echo esc_attr( $value ); ?>" <?php selected( $preselect, $value ); ?>><?php echo esc_html( $label ); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</label>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if ( $animal_id && ! $is_animal ) : ?>
|
||||
<p class="ga-form__animal"><?php echo esc_html( ga__( 'Animal: ', 'Animalia: ' ) . get_the_title( $animal_id ) ); ?></p>
|
||||
<?php endif; ?>
|
||||
<label><?php ga_e( 'Mensaje', 'Mezua' ); ?><?php echo $is_animal ? ' (' . esc_html( ga__( 'opcional', 'aukerakoa' ) ) . ')' : ' *'; ?>
|
||||
<textarea name="mensaje" rows="<?php echo $is_animal ? 4 : 6; ?>"<?php echo $is_animal ? '' : ' required'; ?>></textarea>
|
||||
</label>
|
||||
<label class="ga-form__check">
|
||||
<input type="checkbox" name="privacidad" value="1" required>
|
||||
<span>
|
||||
<?php if ( 'eu' === ga_lang() ) : ?>
|
||||
<a href="<?php echo esc_url( $privacy ); ?>" target="_blank">Pribatutasun-politika</a> irakurri eta onartzen dut. *
|
||||
<?php else : ?>
|
||||
He leído y acepto la <a href="<?php echo esc_url( $privacy ); ?>" target="_blank">política de privacidad</a>. *
|
||||
<?php endif; ?>
|
||||
</span>
|
||||
</label>
|
||||
<button type="submit" class="ga-btn"><?php echo esc_html( $is_animal ? ga__( 'Enviar solicitud', 'Eskaera bidali' ) : ga__( 'Enviar mensaje', 'Mezua bidali' ) ); ?></button>
|
||||
</form>
|
||||
<?php
|
||||
return ob_get_clean();
|
||||
} );
|
||||
|
||||
add_action( 'admin_post_nopriv_ga_contacto', 'ga_handle_contact' );
|
||||
add_action( 'admin_post_ga_contacto', 'ga_handle_contact' );
|
||||
|
||||
function ga_handle_contact() {
|
||||
$redirect = wp_validate_redirect( esc_url_raw( wp_unslash( $_POST['redirect'] ?? '' ) ), home_url( '/' ) );
|
||||
$go = function ( $status ) use ( $redirect ) {
|
||||
$parts = explode( '#', $redirect, 2 );
|
||||
wp_safe_redirect( add_query_arg( 'enviado', $status, $parts[0] ) . ( isset( $parts[1] ) ? '#' . $parts[1] : '' ) );
|
||||
exit;
|
||||
};
|
||||
|
||||
if ( ! isset( $_POST['ga_nonce'] ) || ! wp_verify_nonce( $_POST['ga_nonce'], 'ga_contacto' ) ) {
|
||||
$go( 'error' );
|
||||
}
|
||||
if ( ! empty( $_POST['web'] ) ) { // Honeypot: los bots rellenan el campo oculto.
|
||||
$go( 'ok' );
|
||||
}
|
||||
|
||||
$animal_id = absint( $_POST['animal_id'] ?? 0 );
|
||||
$animal = $animal_id && 'animal' === get_post_type( $animal_id ) ? get_the_title( $animal_id ) : '';
|
||||
$reasons = ga_contact_reasons();
|
||||
$reason = $animal ? 'adopcion' : sanitize_key( $_POST['motivo'] ?? '' );
|
||||
$data = array(
|
||||
'nombre' => sanitize_text_field( wp_unslash( $_POST['nombre'] ?? '' ) ),
|
||||
'email' => sanitize_email( wp_unslash( $_POST['email'] ?? '' ) ),
|
||||
'telefono' => sanitize_text_field( wp_unslash( $_POST['telefono'] ?? '' ) ),
|
||||
'motivo' => $reasons[ $reason ] ?? $reasons['otro'],
|
||||
'mensaje' => sanitize_textarea_field( wp_unslash( $_POST['mensaje'] ?? '' ) ),
|
||||
'idioma' => 'eu' === ( $_POST['idioma'] ?? '' ) ? 'Euskera' : 'Castellano',
|
||||
);
|
||||
$message_required = ! $animal;
|
||||
if ( ! $data['nombre'] || ! is_email( $data['email'] ) || ( $message_required && ! $data['mensaje'] ) || empty( $_POST['privacidad'] ) ) {
|
||||
$go( 'error' );
|
||||
}
|
||||
|
||||
$subject = $animal
|
||||
? sprintf( '[Web] Quiero conocer a %s – %s', $animal, $data['nombre'] )
|
||||
: sprintf( '[Web] %s – %s', $data['motivo'], $data['nombre'] );
|
||||
$body = sprintf(
|
||||
"Nombre: %s\nEmail: %s\nTeléfono: %s\nMotivo: %s\nAnimal: %s\nIdioma: %s\n\n%s",
|
||||
$data['nombre'], $data['email'], $data['telefono'] ?: '-', $data['motivo'],
|
||||
$animal ? $animal . ' — ' . get_permalink( $animal_id ) : '-',
|
||||
$data['idioma'], $data['mensaje'] ?: '(sin mensaje)'
|
||||
);
|
||||
|
||||
// Se guarda siempre en el panel, aunque falle el correo.
|
||||
wp_insert_post( array(
|
||||
'post_type' => 'ga_mensaje',
|
||||
'post_status' => 'private',
|
||||
'post_title' => $subject,
|
||||
'post_content' => $body,
|
||||
) );
|
||||
wp_mail( ga_contact_email(), $subject, $body, array( 'Reply-To: ' . $data['nombre'] . ' <' . $data['email'] . '>' ) );
|
||||
|
||||
$go( 'ok' );
|
||||
}
|
||||
|
||||
/* [ga_necesidades] lista de ayuda material (se edita en Personalizar → Colabora) */
|
||||
add_shortcode( 'ga_necesidades', function () {
|
||||
$items = array_filter( array_map( 'trim', explode( "\n", (string) ga_setting( 'material', 'list', '' ) ) ) );
|
||||
$note = ga_setting( 'material', 'note', '' );
|
||||
ob_start();
|
||||
if ( $items ) {
|
||||
echo '<ul class="ga-needs-list">';
|
||||
foreach ( $items as $item ) {
|
||||
echo '<li>' . esc_html( $item ) . '</li>';
|
||||
}
|
||||
echo '</ul>';
|
||||
}
|
||||
if ( $note ) {
|
||||
echo '<p class="ga-needs-note">' . esc_html( $note ) . '</p>';
|
||||
}
|
||||
return ob_get_clean();
|
||||
} );
|
||||
|
||||
/* [ga_cita] aviso de cita previa */
|
||||
add_shortcode( 'ga_cita', function () {
|
||||
$text = ga_info( 'cita' );
|
||||
return $text ? '<p class="ga-cita">' . esc_html( $text ) . '</p>' : '';
|
||||
} );
|
||||
118
wp-content/mu-plugins/gure-ametsa/i18n.php
Normal file
118
wp-content/mu-plugins/gure-ametsa/i18n.php
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
/**
|
||||
* Idioma (castellano / euskera), datos de la protectora y ajustes.
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/** Idioma actual: 'es' o 'eu'. El panel de administración siempre en castellano. */
|
||||
function ga_lang() {
|
||||
if ( isset( $GLOBALS['ga_forced_lang'] ) ) {
|
||||
return 'eu' === $GLOBALS['ga_forced_lang'] ? 'eu' : 'es';
|
||||
}
|
||||
if ( is_admin() && ! wp_doing_ajax() ) {
|
||||
return 'es';
|
||||
}
|
||||
$lang = function_exists( 'pll_current_language' ) ? pll_current_language() : '';
|
||||
return 'eu' === $lang ? 'eu' : 'es';
|
||||
}
|
||||
|
||||
/** Devuelve el texto en el idioma actual. */
|
||||
function ga__( $es, $eu ) {
|
||||
return 'eu' === ga_lang() ? $eu : $es;
|
||||
}
|
||||
|
||||
/** Imprime el texto escapado en el idioma actual. */
|
||||
function ga_e( $es, $eu ) {
|
||||
echo esc_html( ga__( $es, $eu ) );
|
||||
}
|
||||
|
||||
/** Ejecuta $callback como si el idioma actual fuera $lang. */
|
||||
function ga_with_lang( $lang, callable $callback ) {
|
||||
$previous = $GLOBALS['ga_forced_lang'] ?? null;
|
||||
$GLOBALS['ga_forced_lang'] = $lang;
|
||||
try {
|
||||
return $callback();
|
||||
} finally {
|
||||
if ( null === $previous ) {
|
||||
unset( $GLOBALS['ga_forced_lang'] );
|
||||
} else {
|
||||
$GLOBALS['ga_forced_lang'] = $previous;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** URL de una página por su slug en castellano, en el idioma actual. */
|
||||
function ga_page_url( $slug_es, $fragment = '' ) {
|
||||
$page = get_page_by_path( $slug_es );
|
||||
if ( ! $page ) {
|
||||
return home_url( "/$slug_es/" ) . $fragment;
|
||||
}
|
||||
$id = $page->ID;
|
||||
if ( function_exists( 'pll_get_post' ) ) {
|
||||
$id = pll_get_post( $id, ga_lang() ) ?: $id;
|
||||
}
|
||||
return get_permalink( $id ) . $fragment;
|
||||
}
|
||||
|
||||
/** URL del listado de una especie (slug en castellano: perro, gato) en el idioma actual. */
|
||||
function ga_species_url( $slug_es ) {
|
||||
$term = get_term_by( 'slug', $slug_es, 'especie' );
|
||||
if ( $term && function_exists( 'pll_get_term' ) ) {
|
||||
$translated = pll_get_term( $term->term_id, ga_lang() );
|
||||
$term = $translated ? get_term( $translated, 'especie' ) : $term;
|
||||
}
|
||||
$url = $term && ! is_wp_error( $term ) ? get_term_link( $term ) : '';
|
||||
return is_wp_error( $url ) || ! $url ? get_post_type_archive_link( 'animal' ) : $url;
|
||||
}
|
||||
|
||||
/* Animales y especies son traducibles; los mensajes no. */
|
||||
add_filter( 'pll_get_post_types', function ( $types ) {
|
||||
$types['animal'] = 'animal';
|
||||
unset( $types['ga_mensaje'] );
|
||||
return $types;
|
||||
} );
|
||||
|
||||
add_filter( 'pll_get_taxonomies', function ( $taxonomies ) {
|
||||
$taxonomies['especie'] = 'especie';
|
||||
return $taxonomies;
|
||||
} );
|
||||
|
||||
/**
|
||||
* Ajuste del personalizador del tema, con valor por defecto si el tema no está activo.
|
||||
*/
|
||||
function ga_setting( $section, $field, $default = '' ) {
|
||||
if ( function_exists( 'ga_opt' ) ) {
|
||||
$value = ga_opt( $section, $field );
|
||||
return null === $value ? $default : $value;
|
||||
}
|
||||
return $default;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
* Datos de la protectora (el tema los sustituye por los del personalizador)
|
||||
* ---------------------------------------------------------------------- */
|
||||
|
||||
function ga_info( $key = null ) {
|
||||
$info = apply_filters( 'ga_info', array(
|
||||
'nombre' => 'Bilagun',
|
||||
'direccion' => 'Jaizubia, 44 · 20280 Hondarribia (Gipuzkoa)',
|
||||
'telefono' => '943 64 52 79',
|
||||
'email' => 'hola@gureametsabilagun.org',
|
||||
'horario' => ga__( 'Lunes a viernes: 10:00–13:00 y 14:00–19:00', 'Astelehenetik ostiralera: 10:00–13:00 eta 14:00–19:00' ),
|
||||
'cita' => ga__( 'Atendemos con cita previa. Escríbenos o llámanos antes de venir.', 'Aurretiko hitzorduarekin artatzen dugu. Idatzi edo deitu iezaguzu etorri aurretik.' ),
|
||||
'instagram' => 'https://www.instagram.com/gureametsabilagun/',
|
||||
'facebook' => 'https://www.facebook.com/gureametsabilagun/',
|
||||
'maps' => 'https://www.google.com/maps/search/?api=1&query=Jaizubia+44+Hondarribia',
|
||||
) );
|
||||
return $key ? ( $info[ $key ] ?? '' ) : $info;
|
||||
}
|
||||
|
||||
/** Correo que recibe los formularios: ajuste del panel → variable GA_CONTACT_EMAIL → administrador. */
|
||||
function ga_contact_email() {
|
||||
$email = ga_setting( 'adopcion', 'form_email', '' );
|
||||
if ( ! is_email( $email ) ) {
|
||||
$email = getenv( 'GA_CONTACT_EMAIL' );
|
||||
}
|
||||
return is_email( $email ) ? $email : get_option( 'admin_email' );
|
||||
}
|
||||
@@ -3,12 +3,12 @@ get_header();
|
||||
?>
|
||||
<section class="ga-404">
|
||||
<div class="ga-narrow">
|
||||
<?php echo ga_icon( 'paw' ); ?>
|
||||
<?php echo ga_placeholder_svg(); ?>
|
||||
<h1><?php ga_e( 'Vaya, esta página se ha escapado', 'Ai ama, orri hau ihes egin du' ); ?></h1>
|
||||
<p><?php ga_e( 'No encontramos lo que buscas, pero hay muchos animales que sí te están buscando a ti.', 'Ez dugu bilatzen duzuna aurkitu, baina animalia asko zure bila dabiltza.' ); ?></p>
|
||||
<p>
|
||||
<a class="ga-btn" href="<?php echo esc_url( get_post_type_archive_link( 'animal' ) ); ?>"><?php ga_e( 'Ver animales en adopción', 'Ikusi adopzioko animaliak' ); ?></a>
|
||||
<a class="ga-btn ga-btn--ghost" href="<?php echo esc_url( ga_home_url() ); ?>"><?php ga_e( 'Ir al inicio', 'Hasierara joan' ); ?></a>
|
||||
<a class="ga-btn ga-btn--outline" href="<?php echo esc_url( ga_home_url() ); ?>"><?php ga_e( 'Ir al inicio', 'Hasierara joan' ); ?></a>
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -1,98 +1,60 @@
|
||||
<?php
|
||||
global $wp_query;
|
||||
/**
|
||||
* Adopta (/adopta/) y listados de cada especie (/especie/perro/, /especie/gato/).
|
||||
* Sin filtros: la única separación es Perros / Gatos.
|
||||
*/
|
||||
get_header();
|
||||
|
||||
$base = get_post_type_archive_link( 'animal' );
|
||||
$current = is_tax( 'especie' ) ? get_queried_object() : null;
|
||||
$here = $current ? get_term_link( $current ) : $base;
|
||||
$fields = ga_fields();
|
||||
$especies = get_terms( array( 'taxonomy' => 'especie', 'hide_empty' => false ) );
|
||||
$params = array_filter( array(
|
||||
'tamano' => sanitize_key( (string) get_query_var( 'tamano' ) ),
|
||||
'sexo' => sanitize_key( (string) get_query_var( 'sexo' ) ),
|
||||
'edad' => sanitize_key( (string) get_query_var( 'edad' ) ),
|
||||
'con' => sanitize_key( (string) get_query_var( 'con' ) ),
|
||||
) );
|
||||
|
||||
/** Chip que activa o desactiva un filtro manteniendo el resto. */
|
||||
$chip = function ( $key, $value, $label ) use ( $params, $here ) {
|
||||
$active = ( $params[ $key ] ?? '' ) === $value;
|
||||
$args = $params;
|
||||
if ( $active ) {
|
||||
unset( $args[ $key ] );
|
||||
} else {
|
||||
$args[ $key ] = $value;
|
||||
}
|
||||
printf(
|
||||
'<a class="ga-chip%s" href="%s"%s>%s</a>',
|
||||
$active ? ' is-active' : '',
|
||||
esc_url( add_query_arg( $args, $here ) ),
|
||||
$active ? ' aria-current="true"' : '',
|
||||
esc_html( $label )
|
||||
);
|
||||
};
|
||||
|
||||
$groups = array(
|
||||
'tamano' => array( $fields['tamano']['label'], $fields['tamano']['options'] ),
|
||||
'edad' => array( ga__( 'Edad', 'Adina' ), ga_age_groups() ),
|
||||
'sexo' => array( $fields['sexo']['label'], $fields['sexo']['options'] ),
|
||||
'con' => array( $fields['compatible']['label'], $fields['compatible']['options'] ),
|
||||
$current = is_tax( 'especie' ) ? get_queried_object() : null;
|
||||
$tiles = ! $current && 'tiles' === ga_opt( 'adopcion', 'archive_mode' );
|
||||
$groups = array(
|
||||
'perro' => array( ga_opt( 'adopcion', 'dog_label' ), (int) ga_opt( 'adopcion', 'dog_image' ), 'dog' ),
|
||||
'gato' => array( ga_opt( 'adopcion', 'cat_label' ), (int) ga_opt( 'adopcion', 'cat_image' ), 'cat' ),
|
||||
);
|
||||
|
||||
$title = $current
|
||||
? ga__( ga_plural( $current->name ) . ' en adopción', ga_plural( $current->name ) . ' adopzioan' )
|
||||
: ga__( 'Animales en adopción', 'Animaliak adopzioan' );
|
||||
$title = $current ? $current->name : ga__( 'Adopta', 'Adoptatu' );
|
||||
if ( $current ) {
|
||||
$title = ga_plural( $current->name );
|
||||
}
|
||||
?>
|
||||
|
||||
<header class="ga-page-head">
|
||||
<div class="ga-wrap">
|
||||
<span class="ga-eyebrow"><?php ga_e( 'Puerta uno · Adopta', 'Lehen atea · Adoptatu' ); ?></span>
|
||||
<span class="ga-eyebrow"><?php ga_e( 'Adopta', 'Adoptatu' ); ?></span>
|
||||
<h1><?php echo esc_html( $title ); ?></h1>
|
||||
<p><?php ga_e( 'Todos se entregan con microchip, vacunas al día y esterilizados. Si alguno te roba el corazón, escríbenos y te contamos todo sobre él.', 'Guztiak mikrotxiparekin, txertoak egunean eta antzututa ematen dira. Norbaitek bihotza lapurtzen badizu, idatzi iezaguzu eta dena kontatuko dizugu.' ); ?></p>
|
||||
<?php if ( ga_opt( 'adopcion', 'intro' ) ) : ?>
|
||||
<p><?php ga_opt_e( 'adopcion', 'intro' ); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section class="ga-section ga-section--tight">
|
||||
<div class="ga-wrap">
|
||||
<div class="ga-filters">
|
||||
<div class="ga-filters__grid">
|
||||
<div class="ga-filters__group">
|
||||
<span class="ga-filters__label"><?php ga_e( 'Especie', 'Espeziea' ); ?></span>
|
||||
<div class="ga-filters__chips">
|
||||
<?php foreach ( (array) $especies as $term ) : ?>
|
||||
<?php $active = $current && $current->term_id === $term->term_id; ?>
|
||||
<a class="ga-chip<?php echo $active ? ' is-active' : ''; ?>" href="<?php echo esc_url( add_query_arg( $params, $active ? $base : get_term_link( $term ) ) ); ?>"><?php echo esc_html( ga_plural( $term->name ) ); ?></a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php foreach ( $groups as $key => [ $label, $options ] ) : ?>
|
||||
<div class="ga-filters__group">
|
||||
<span class="ga-filters__label"><?php echo esc_html( $label ); ?></span>
|
||||
<div class="ga-filters__chips">
|
||||
<?php foreach ( $options as $value => $option ) : ?>
|
||||
<?php $chip( $key, $value, $option ); ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ( ! $tiles ) : ?>
|
||||
<nav class="ga-tabs" aria-label="<?php echo esc_attr( ga__( 'Especies', 'Espezieak' ) ); ?>">
|
||||
<?php foreach ( $groups as $slug => [ $label ] ) : ?>
|
||||
<?php
|
||||
$url = ga_species_url( $slug );
|
||||
$active = $current && untrailingslashit( get_term_link( $current ) ) === untrailingslashit( $url );
|
||||
?>
|
||||
<a class="ga-tab<?php echo $active ? ' is-active' : ''; ?>" href="<?php echo esc_url( $url ); ?>"<?php echo $active ? ' aria-current="page"' : ''; ?>><?php echo esc_html( $label ); ?></a>
|
||||
<?php endforeach; ?>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $tiles ) : ?>
|
||||
<div class="ga-species">
|
||||
<?php foreach ( $groups as $slug => [ $label, $image, $class ] ) : ?>
|
||||
<a class="ga-species__tile ga-species__tile--<?php echo esc_attr( $class ); ?>" href="<?php echo esc_url( ga_species_url( $slug ) ); ?>">
|
||||
<?php if ( $image ) : ?>
|
||||
<?php echo wp_get_attachment_image( $image, 'large', false, array( 'alt' => '' ) ); ?>
|
||||
<?php else : ?>
|
||||
<span class="ga-species__paw"><?php echo ga_placeholder_svg(); ?></span>
|
||||
<?php endif; ?>
|
||||
<span class="ga-species__label"><?php echo esc_html( $label ); ?> <span aria-hidden="true">→</span></span>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<div class="ga-filters__footer">
|
||||
<span class="ga-filters__count">
|
||||
<?php
|
||||
$n = (int) $wp_query->found_posts;
|
||||
echo wp_kses( ga__(
|
||||
sprintf( 'Mostrando <strong>%d</strong> %s', $n, 1 === $n ? 'animal' : 'animales' ),
|
||||
sprintf( '<strong>%d</strong> animalia erakusten', $n )
|
||||
), array( 'strong' => array() ) );
|
||||
?>
|
||||
</span>
|
||||
<?php if ( $params || $current ) : ?>
|
||||
<a class="ga-btn ga-btn--small ga-btn--outline" href="<?php echo esc_url( $base ); ?>"><?php ga_e( 'Quitar filtros', 'Kendu iragazkiak' ); ?></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ( have_posts() ) : ?>
|
||||
<?php elseif ( have_posts() ) : ?>
|
||||
<div class="ga-grid">
|
||||
<?php
|
||||
while ( have_posts() ) :
|
||||
@@ -105,16 +67,10 @@ $title = $current
|
||||
<?php echo paginate_links( array( 'prev_text' => '←', 'next_text' => '→' ) ); ?>
|
||||
</nav>
|
||||
<?php else : ?>
|
||||
<p class="ga-empty"><?php ga_e( 'No hay animales que coincidan con estos filtros ahora mismo. ¡Prueba con otros o vuelve pronto!', 'Une honetan ez dago iragazki hauekin bat datorren animaliarik. Probatu beste batzuekin edo itzuli laster!' ); ?></p>
|
||||
<p class="ga-empty"><?php ga_e( 'Ahora mismo no hay animales en esta sección. ¡Vuelve pronto!', 'Une honetan ez dago animaliarik atal honetan. Itzuli laster!' ); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="ga-panel ga-panel--soft ga-archive-help">
|
||||
<div>
|
||||
<h3><?php ga_e( '¿No puedes adoptar?', 'Ezin duzu adoptatu?' ); ?></h3>
|
||||
<p><?php ga_e( 'Puedes ser casa de acogida, voluntario/a o ayudarnos con donaciones.', 'Harrera-etxe, boluntario izan zaitezke edo dohaintzekin lagundu.' ); ?></p>
|
||||
</div>
|
||||
<a class="ga-btn ga-btn--primary" href="<?php echo esc_url( ga_page_url( 'colabora' ) ); ?>"><?php ga_e( 'Descubre cómo colaborar', 'Ikusi nola lagundu' ); ?> <?php echo ga_icon( 'arrow' ); ?></a>
|
||||
</div>
|
||||
<?php get_template_part( 'template-parts/adoption-process' ); ?>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -62,3 +62,24 @@
|
||||
update();
|
||||
} );
|
||||
} )();
|
||||
|
||||
// Ficha: miniaturas de la galería y copiar enlace.
|
||||
( function () {
|
||||
var main = document.querySelector( '[data-ga-gallery-main] img' );
|
||||
document.querySelectorAll( '.ga-thumbs button' ).forEach( function ( btn ) {
|
||||
btn.addEventListener( 'click', function () {
|
||||
if ( ! main ) { return; }
|
||||
main.src = btn.dataset.full;
|
||||
main.removeAttribute( 'srcset' );
|
||||
document.querySelectorAll( '.ga-thumbs button' ).forEach( function ( b ) { b.removeAttribute( 'aria-current' ); } );
|
||||
btn.setAttribute( 'aria-current', 'true' );
|
||||
} );
|
||||
} );
|
||||
document.querySelectorAll( '[data-copy]' ).forEach( function ( btn ) {
|
||||
btn.addEventListener( 'click', function () {
|
||||
if ( navigator.clipboard ) {
|
||||
navigator.clipboard.writeText( btn.dataset.copy ).then( function () { btn.textContent = btn.dataset.done; } );
|
||||
}
|
||||
} );
|
||||
} );
|
||||
} )();
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
<?php
|
||||
$colabora = ga_page_url( 'colabora' );
|
||||
$columns = array(
|
||||
ga__( 'Adopta', 'Adoptatu' ) => array(
|
||||
ga__( 'Animales disponibles', 'Animalia eskuragarriak' ) => get_post_type_archive_link( 'animal' ),
|
||||
ga__( 'Cómo adoptar', 'Nola adoptatu' ) => $colabora . '#adopcion',
|
||||
ga__( 'Quiénes somos', 'Nor gara' ) => ga_page_url( 'quienes-somos' ),
|
||||
ga__( 'Hotel para perros y gatos', 'Txakur eta katuentzako hotela' ) => ga_page_url( 'hotel' ),
|
||||
ga__( 'Adopta', 'Adoptatu' ) => array(
|
||||
ga__( 'Perros', 'Txakurrak' ) => ga_species_url( 'perro' ),
|
||||
ga__( 'Gatos', 'Katuak' ) => ga_species_url( 'gato' ),
|
||||
ga__( 'Acoge', 'Harrera' ) => ga_page_url( 'acoge' ),
|
||||
),
|
||||
ga__( 'Colabora', 'Lagundu' ) => array(
|
||||
ga__( 'Casa de acogida', 'Harrera-etxea' ) => $colabora . '#acogida',
|
||||
ga__( 'Voluntariado', 'Boluntariotza' ) => $colabora . '#voluntariado',
|
||||
ga__( 'Donaciones', 'Dohaintzak' ) => $colabora . '#donaciones',
|
||||
ga__( 'Contacto', 'Harremanetarako' ) => ga_page_url( 'contacto' ),
|
||||
ga__( 'Colabora', 'Lagundu' ) => array(
|
||||
ga__( 'Voluntariado', 'Boluntariotza' ) => $colabora . '#voluntariado',
|
||||
ga__( 'Ayuda material', 'Laguntza materiala' ) => $colabora . '#material',
|
||||
),
|
||||
'Bilagun' => array(
|
||||
ga__( 'Quiénes somos', 'Nor gara' ) => ga_page_url( 'quienes-somos' ),
|
||||
ga__( 'Preguntas frecuentes', 'Ohiko galderak' ) => ga_page_url( 'preguntas-frecuentes' ),
|
||||
ga__( 'Contacto', 'Harremanetarako' ) => ga_page_url( 'contacto' ),
|
||||
),
|
||||
);
|
||||
?>
|
||||
@@ -40,6 +42,9 @@ $columns = array(
|
||||
<div>
|
||||
<h2><?php ga_e( 'Visítanos', 'Etorri gu ikustera' ); ?></h2>
|
||||
<ul>
|
||||
<?php if ( ga_info( 'cita' ) ) : ?>
|
||||
<li class="ga-footer__cita"><?php echo esc_html( ga_info( 'cita' ) ); ?></li>
|
||||
<?php endif; ?>
|
||||
<?php if ( ga_info( 'direccion' ) ) : ?>
|
||||
<li><a href="<?php echo esc_url( ga_info( 'maps' ) ); ?>" target="_blank" rel="noopener"><?php echo esc_html( ga_info( 'direccion' ) ); ?></a></li>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
define( 'GA_THEME_VERSION', '2.1.0' );
|
||||
define( 'GA_THEME_VERSION', '2.2.0' );
|
||||
|
||||
require_once __DIR__ . '/inc/customizer.php';
|
||||
require_once __DIR__ . '/inc/dynamic-css.php';
|
||||
@@ -171,22 +171,65 @@ function ga_brand( $context = 'header' ) {
|
||||
}
|
||||
|
||||
/* ---------- Ayudantes de animales ---------- */
|
||||
/** Distintivo de estado: solo se muestra «En proceso» o «Adoptado» (los disponibles no llevan etiqueta). */
|
||||
function ga_status_badge( $post_id = null ) {
|
||||
$post_id = $post_id ?: get_the_ID();
|
||||
$estado = ga_get( $post_id, 'estado' ) ?: 'disponible';
|
||||
$label = ga_label( $post_id, 'estado' ) ?: ga__( 'En adopción', 'Adopzioan' );
|
||||
printf( '<span class="ga-status ga-status--%s">%s</span>', esc_attr( $estado ), esc_html( $label ) );
|
||||
$estado = ga_status( $post_id );
|
||||
if ( 'disponible' === $estado ) {
|
||||
return;
|
||||
}
|
||||
printf( '<span class="ga-status ga-status--%s">%s</span>', esc_attr( $estado ), esc_html( ga_label( $post_id, 'estado' ) ) );
|
||||
}
|
||||
|
||||
/** Foto principal o, si no hay, la silueta del logo. */
|
||||
function ga_animal_photo( $size = 'ga-card', $post_id = null ) {
|
||||
$post_id = $post_id ?: get_the_ID();
|
||||
if ( has_post_thumbnail( $post_id ) ) {
|
||||
echo get_the_post_thumbnail( $post_id, $size, array( 'loading' => 'lazy' ) );
|
||||
} else {
|
||||
echo '<div class="ga-card__placeholder">' . ga_icon( 'paw' ) . '</div>';
|
||||
echo '<div class="ga-card__placeholder">' . ga_placeholder_svg() . '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
/** Silueta del logo para huecos sin foto. */
|
||||
function ga_placeholder_svg() {
|
||||
return ga_logo_svg( 'mark' ) ?: ga_icon( 'paw' );
|
||||
}
|
||||
|
||||
/** Texto del botón «Quiero conocerlo / conocerla» según el sexo. */
|
||||
function ga_meet_label( $post_id = null ) {
|
||||
$post_id = $post_id ?: get_the_ID();
|
||||
return 'hembra' === ga_get( $post_id, 'sexo' ) ? ga_opt( 'adopcion', 'btn_f' ) : ga_opt( 'adopcion', 'btn_m' );
|
||||
}
|
||||
|
||||
/** Enlaces para compartir una ficha. */
|
||||
function ga_share_links( $post_id = null ) {
|
||||
$post_id = $post_id ?: get_the_ID();
|
||||
$url = get_permalink( $post_id );
|
||||
$text = get_the_title( $post_id ) . ' — ' . ga__( 'busca familia en Bilagun', 'familia bila Bilagunen' );
|
||||
printf(
|
||||
'<div class="ga-share"><span>%s</span><a class="ga-share__btn" href="%s" target="_blank" rel="noopener">WhatsApp</a><a class="ga-share__btn" href="%s" target="_blank" rel="noopener">Facebook</a><button type="button" class="ga-share__btn" data-copy="%s" data-done="%s">%s</button></div>',
|
||||
esc_html( ga__( 'Comparte su historia:', 'Partekatu haren istorioa:' ) ),
|
||||
esc_url( 'https://wa.me/?text=' . rawurlencode( $text . ' ' . $url ) ),
|
||||
esc_url( 'https://www.facebook.com/sharer/sharer.php?u=' . rawurlencode( $url ) ),
|
||||
esc_attr( $url ),
|
||||
esc_attr( ga__( '¡Copiado!', 'Kopiatuta!' ) ),
|
||||
esc_html( ga__( 'Copiar enlace', 'Kopiatu esteka' ) )
|
||||
);
|
||||
}
|
||||
|
||||
/** Vídeo de la ficha: oEmbed (YouTube, Vimeo…) o archivo de vídeo. */
|
||||
function ga_video_html( $url ) {
|
||||
if ( ! $url ) {
|
||||
return '';
|
||||
}
|
||||
if ( preg_match( '/\.(mp4|webm|mov)(\?.*)?$/i', $url ) ) {
|
||||
return '<video controls preload="metadata" playsinline src="' . esc_url( $url ) . '"></video>';
|
||||
}
|
||||
$embed = wp_oembed_get( $url, array( 'width' => 900 ) );
|
||||
return $embed ?: '<a href="' . esc_url( $url ) . '" target="_blank" rel="noopener">' . esc_html( ga__( 'Ver vídeo', 'Ikusi bideoa' ) ) . '</a>';
|
||||
}
|
||||
|
||||
function ga_species( $post_id = null ) {
|
||||
$terms = get_the_terms( $post_id ?: get_the_ID(), 'especie' );
|
||||
return $terms && ! is_wp_error( $terms ) ? $terms[0]->name : '';
|
||||
@@ -199,15 +242,6 @@ function ga_plural( $name ) {
|
||||
return preg_match( '/s$/i', $name ) ? $name : $name . 's';
|
||||
}
|
||||
|
||||
/** «Bien con niños» / «Haurrekin ondo» a partir de la etiqueta «Niños» / «Haurrak». */
|
||||
function ga_compat_label( $label ) {
|
||||
$label = mb_strtolower( $label );
|
||||
if ( 'eu' === ga_lang() ) {
|
||||
return mb_strtoupper( mb_substr( $label, 0, 1 ) ) . mb_substr( preg_replace( '/ak$/u', 'ekin', $label ), 1 ) . ' ondo';
|
||||
}
|
||||
return 'Bien con ' . $label;
|
||||
}
|
||||
|
||||
/** URL de la página de contacto con el animal preseleccionado. */
|
||||
function ga_adopt_url( $post_id = null ) {
|
||||
return add_query_arg( 'adoptar', $post_id ?: get_the_ID(), ga_page_url( 'contacto' ) ) . '#formulario';
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
'theme_location' => 'primary',
|
||||
'container' => false,
|
||||
'fallback_cb' => false,
|
||||
'depth' => 1,
|
||||
'depth' => 2,
|
||||
) );
|
||||
?>
|
||||
</nav>
|
||||
|
||||
@@ -66,7 +66,7 @@ function ga_home_sections() {
|
||||
|
||||
/* Los datos de contacto y redes del personalizador sustituyen a los predeterminados. */
|
||||
add_filter( 'ga_info', function ( $info ) {
|
||||
foreach ( array( 'direccion', 'maps', 'telefono', 'email', 'horario' ) as $key ) {
|
||||
foreach ( array( 'direccion', 'maps', 'telefono', 'email', 'horario', 'cita' ) as $key ) {
|
||||
$info[ $key ] = ga_opt( 'contact', $key );
|
||||
}
|
||||
foreach ( array( 'instagram', 'facebook', 'tiktok', 'youtube', 'whatsapp' ) as $key ) {
|
||||
@@ -79,6 +79,7 @@ add_filter( 'ga_info', function ( $info ) {
|
||||
add_action( 'customize_register', function ( WP_Customize_Manager $c ) {
|
||||
$c->add_panel( 'ga_design', array( 'title' => 'Diseño (Gure Ametsa)', 'priority' => 25 ) );
|
||||
$c->add_panel( 'ga_info', array( 'title' => 'Contacto y redes', 'priority' => 26 ) );
|
||||
$c->add_panel( 'ga_adopt', array( 'title' => 'Adopción y colabora', 'priority' => 26 ) );
|
||||
$c->add_panel( 'ga_home', array(
|
||||
'title' => 'Portada',
|
||||
'priority' => 27,
|
||||
|
||||
@@ -199,9 +199,9 @@ function ga_pattern_definitions( $t, $url ) {
|
||||
$t( 'Tres tarjetas', 'Hiru txartel' ),
|
||||
'Tres columnas con icono, título y texto.',
|
||||
ga_p_columns( array(
|
||||
ga_p_paragraph( '🏡', 'ga-antetitulo' ) . "\n\n" . ga_p_heading( $t( 'Adopta', 'Adoptatu' ), 3 ) . "\n\n" . ga_p_paragraph( $t( 'Dale un hogar para siempre a un perro o un gato.', 'Eman betiko etxe bat txakur edo katu bati.' ) ),
|
||||
ga_p_paragraph( '🤝', 'ga-antetitulo' ) . "\n\n" . ga_p_heading( $t( 'Acoge', 'Harrera egin' ), 3 ) . "\n\n" . ga_p_paragraph( $t( 'Abre tu casa de forma temporal a quien más lo necesita.', 'Ireki zure etxea aldi baterako gehien behar duenari.' ) ),
|
||||
ga_p_paragraph( '💚', 'ga-antetitulo' ) . "\n\n" . ga_p_heading( $t( 'Dona', 'Egin dohaintza' ), 3 ) . "\n\n" . ga_p_paragraph( $t( 'Pienso, mantas o material veterinario.', 'Pentsua, mantak edo albaitaritza-materiala.' ) ),
|
||||
ga_p_heading( $t( 'Adopta', 'Adoptatu' ), 3 ) . "\n\n" . ga_p_paragraph( $t( 'Conoce a los perros y gatos que esperan una familia.', 'Ezagutu familia baten zain dauden txakur eta katuak.' ) ),
|
||||
ga_p_heading( $t( 'Acoge', 'Harrera egin' ), 3 ) . "\n\n" . ga_p_paragraph( $t( 'Ofrece un hogar durante un tiempo a quien lo necesita.', 'Eskaini etxe bat denbora batez behar duenari.' ) ),
|
||||
ga_p_heading( $t( 'Colabora', 'Lagundu' ), 3 ) . "\n\n" . ga_p_paragraph( $t( 'Voluntariado o ayuda material.', 'Boluntariotza edo laguntza materiala.' ) ),
|
||||
), 'ga-tarjetas' ),
|
||||
),
|
||||
'pasos' => array(
|
||||
@@ -271,15 +271,11 @@ function ga_pattern_definitions( $t, $url ) {
|
||||
),
|
||||
'donaciones' => array(
|
||||
$t( 'Qué necesitamos', 'Zer behar dugu' ),
|
||||
'Tarjeta con lista de necesidades y botón.',
|
||||
'Tarjeta con la lista de ayuda material (se edita en Personalizar → Adopción y colabora → Ayuda material).',
|
||||
ga_p_group(
|
||||
ga_p_heading( $t( 'Qué necesitamos ahora', 'Zer behar dugun orain' ), 3 )
|
||||
. "\n\n" . ga_p_list( array(
|
||||
$t( 'Pienso para cachorros', 'Kumeentzako pentsua' ),
|
||||
$t( 'Arena para gatos', 'Katuentzako harea' ),
|
||||
$t( 'Mantas y toallas', 'Mantak eta eskuoihalak' ),
|
||||
), 'ga-check' )
|
||||
. "\n\n" . ga_p_buttons( array( ga_p_button( $t( 'Quiero colaborar', 'Lagundu nahi dut' ), $contacto ) ) ),
|
||||
. "\n\n" . ga_p_shortcode( '[ga_necesidades]' )
|
||||
. "\n\n" . ga_p_buttons( array( ga_p_button( $t( 'Escríbenos antes de traerlo', 'Idatzi iezaguzu ekarri aurretik' ), $url( 'contacto', 'harremanetarako' ) . '?motivo=material#formulario' ) ) ),
|
||||
'ga-tarjeta'
|
||||
),
|
||||
),
|
||||
@@ -289,10 +285,10 @@ function ga_pattern_definitions( $t, $url ) {
|
||||
ga_p_columns( array(
|
||||
ga_p_heading( $t( 'Ven a vernos', 'Etorri gu ikustera' ), 3 )
|
||||
. "\n\n" . ga_p_list( array(
|
||||
'📍 Jaizubia, 44 · 20280 Hondarribia',
|
||||
'📞 <a href="tel:+34943645279">943 64 52 79</a>',
|
||||
'✉️ <a href="mailto:hola@gureametsabilagun.org">hola@gureametsabilagun.org</a>',
|
||||
$t( '🕙 L–V: 10:00–13:00 y 14:00–19:00', '🕙 Al–Or: 10:00–13:00 eta 14:00–19:00' ),
|
||||
'Jaizubia, 44 · 20280 Hondarribia',
|
||||
'<a href="tel:+34943645279">943 64 52 79</a>',
|
||||
'<a href="mailto:hola@gureametsabilagun.org">hola@gureametsabilagun.org</a>',
|
||||
$t( 'Con cita previa', 'Aurretiko hitzorduarekin' ),
|
||||
), 'ga-limpia' ),
|
||||
ga_p_heading( $t( 'Escríbenos', 'Idatzi iezaguzu' ), 3, false, 'formulario' )
|
||||
. "\n\n" . ga_p_shortcode( '[ga_contacto]' ),
|
||||
|
||||
@@ -167,8 +167,8 @@ function ga_customizer_registry() {
|
||||
'title' => 'Pie de página',
|
||||
'fields' => array(
|
||||
'about' => $t( 'Texto de presentación',
|
||||
'Protectora y residencia de animales en Jaizubia, Hondarribia. Desde hace más de 25 años recogemos, cuidamos y buscamos hogar a los perros y gatos abandonados de Irun y Hondarribia.',
|
||||
'Animalien babesleku eta egoitza Jaizubian, Hondarribian. 25 urte baino gehiago daramatzagu Irun eta Hondarribiko txakur eta katu abandonatuak jasotzen, zaintzen eta etxe bat bilatzen.', 'textarea' ),
|
||||
'Bilagun es la protectora de Jaizubia, en Hondarribia. Cuidamos de los perros y gatos que llegan a nosotras y les buscamos una segunda oportunidad.',
|
||||
'Bilagun Jaizubiko babeslekua da, Hondarribian. Guregana iristen diren txakur eta katuak zaintzen ditugu eta bigarren aukera bat bilatzen diegu.', 'textarea' ),
|
||||
'copyright' => array( 'type' => 'text', 'label' => 'Texto de copyright', 'default' => 'Gure Ametsa Bi Lagun' ),
|
||||
),
|
||||
),
|
||||
@@ -180,9 +180,10 @@ function ga_customizer_registry() {
|
||||
'fields' => array(
|
||||
'direccion' => array( 'type' => 'text', 'label' => 'Dirección', 'default' => 'Jaizubia, 44 · 20280 Hondarribia (Gipuzkoa)' ),
|
||||
'maps' => array( 'type' => 'url', 'label' => 'Enlace a Google Maps', 'default' => 'https://www.google.com/maps/search/?api=1&query=Jaizubia+44+Hondarribia' ),
|
||||
'telefono' => array( 'type' => 'text', 'label' => 'Teléfono', 'default' => '943 64 52 79' ),
|
||||
'telefono' => array( 'type' => 'text', 'label' => 'Teléfono de atención', 'default' => '943 64 52 79', 'description' => 'El de atención de Bilagun, no el del servicio municipal.' ),
|
||||
'email' => array( 'type' => 'email', 'label' => 'Email', 'default' => 'hola@gureametsabilagun.org' ),
|
||||
'horario' => $t( 'Horario', 'Lunes a viernes: 10:00–13:00 y 14:00–19:00', 'Astelehenetik ostiralera: 10:00–13:00 eta 14:00–19:00' ),
|
||||
'horario' => $t( 'Horario de atención al público', 'Lunes a viernes: 10:00–13:00 y 14:00–19:00', 'Astelehenetik ostiralera: 10:00–13:00 eta 14:00–19:00' ),
|
||||
'cita' => $t( 'Aviso de cita previa (vacío = ocultar)', 'Atendemos con cita previa. Escríbenos o llámanos antes de venir.', 'Aurretiko hitzorduarekin artatzen dugu. Idatzi edo deitu iezaguzu etorri aurretik.', 'textarea' ),
|
||||
),
|
||||
),
|
||||
'social' => array(
|
||||
@@ -197,10 +198,62 @@ function ga_customizer_registry() {
|
||||
),
|
||||
),
|
||||
|
||||
/* ================= Adopción ================= */
|
||||
'adopcion' => array(
|
||||
'panel' => 'ga_adopt',
|
||||
'title' => 'Listado y fichas',
|
||||
'fields' => array(
|
||||
'archive_mode' => array( 'type' => 'select', 'label' => 'Página «Adopta»', 'default' => 'tiles', 'choices' => array(
|
||||
'tiles' => 'Dos accesos: Perros y Gatos',
|
||||
'grid' => 'Todos los animales juntos',
|
||||
) ),
|
||||
'intro' => $t( 'Texto de la página Adopta',
|
||||
'Queremos que conozcas a cada animal por su historia y por cómo es. Entra en sus fichas y descubre quién hay detrás de cada nombre.',
|
||||
'Animalia bakoitza bere istorioagatik eta nolakoa den ezagutzea nahi dugu. Sartu haien fitxetan eta ezagutu izen bakoitzaren atzean nor dagoen.', 'textarea' ),
|
||||
'dog_label' => $t( 'Acceso a perros · texto', 'Perros', 'Txakurrak' ),
|
||||
'dog_image' => array( 'type' => 'image', 'label' => 'Acceso a perros · foto', 'default' => 0 ),
|
||||
'cat_label' => $t( 'Acceso a gatos · texto', 'Gatos', 'Katuak' ),
|
||||
'cat_image' => array( 'type' => 'image', 'label' => 'Acceso a gatos · foto', 'default' => 0 ),
|
||||
'card' => array( 'type' => 'select', 'label' => 'Tarjetas del listado', 'default' => 'simple', 'choices' => array(
|
||||
'simple' => 'Solo foto y nombre',
|
||||
'detallada' => 'Foto, nombre, edad y frase corta',
|
||||
) ),
|
||||
'show_in_process' => array( 'type' => 'checkbox', 'label' => 'Mostrar en el listado los que están «En proceso»', 'default' => true ),
|
||||
'card_status' => array( 'type' => 'checkbox', 'label' => 'Indicar «En proceso» en su tarjeta', 'default' => true ),
|
||||
'order' => array( 'type' => 'select', 'label' => 'Orden del listado', 'default' => 'recientes', 'choices' => array(
|
||||
'recientes' => 'Los últimos publicados primero',
|
||||
'antiguos' => 'Los que llevan más tiempo primero',
|
||||
) ),
|
||||
'btn_m' => $t( 'Botón de la ficha (macho)', 'Quiero conocerlo', 'Ezagutu nahi dut' ),
|
||||
'btn_f' => $t( 'Botón de la ficha (hembra)', 'Quiero conocerla', 'Ezagutu nahi dut' ),
|
||||
'form_intro' => $t( 'Texto sobre el formulario', 'Déjanos tus datos y te escribiremos para enviarte nuestro cuestionario de adopción.', 'Utzi zure datuak eta idatziko dizugu gure adopzio-galdetegia bidaltzeko.', 'textarea' ),
|
||||
'confirm' => $t( 'Confirmación tras «Quiero conocerlo/la»', 'Hemos recibido tu solicitud. Nos pondremos en contacto contigo para enviarte nuestro cuestionario y conoceros un poquito mejor.', 'Zure eskaera jaso dugu. Zurekin harremanetan jarriko gara gure galdetegia bidaltzeko eta elkar hobeto ezagutzeko.', 'textarea' ),
|
||||
'confirm_contact' => $t( 'Confirmación del formulario de contacto', '¡Gracias! Hemos recibido tu mensaje y te responderemos lo antes posible.', 'Eskerrik asko! Zure mezua jaso dugu eta ahalik eta lasterren erantzungo dizugu.', 'textarea' ),
|
||||
'process_title' => $t( 'Proceso · título', '¿Cómo es el proceso?', 'Nolakoa da prozesua?' ),
|
||||
'process' => $t( 'Proceso · pasos (uno por línea)',
|
||||
"Nos escribes y te enviamos nuestro cuestionario.\nLo valoramos con el equipo.\nQuedamos para conoceros, siempre con cita previa.",
|
||||
"Idazten diguzu eta gure galdetegia bidaltzen dizugu.\nTaldearekin baloratzen dugu.\nElkar ezagutzeko geratzen gara, beti aurretiko hitzorduarekin.", 'textarea' ),
|
||||
'process_note' => $t( 'Proceso · nota', 'Enviar la solicitud no confirma una adopción: es el primer paso para conocernos.', 'Eskaera bidaltzeak ez du adopzioa baieztatzen: elkar ezagutzeko lehen urratsa da.' ),
|
||||
'share' => array( 'type' => 'checkbox', 'label' => 'Botones para compartir la ficha (WhatsApp, Facebook, copiar enlace)', 'default' => true ),
|
||||
'form_email' => array( 'type' => 'email', 'label' => 'Correo que recibe las solicitudes y mensajes', 'default' => '', 'description' => 'Vacío = el de la variable GA_CONTACT_EMAIL del servidor.' ),
|
||||
),
|
||||
),
|
||||
'material' => array(
|
||||
'panel' => 'ga_adopt',
|
||||
'title' => 'Ayuda material',
|
||||
'fields' => array(
|
||||
'title' => $t( 'Título', 'Qué necesitamos ahora', 'Zer behar dugun orain' ),
|
||||
'list' => $t( 'Necesidades actuales (una por línea)',
|
||||
"Pienso para perros y gatos\nArena para gatos\nMantas y toallas",
|
||||
"Txakur eta katuentzako pentsua\nKatuentzako harea\nMantak eta eskuoihalak", 'textarea' ),
|
||||
'note' => $t( 'Nota', 'Antes de traer nada, escríbenos para concretar la entrega y comprobar qué necesitamos.', 'Ezer ekarri aurretik, idatzi iezaguzu entrega zehazteko eta zer behar dugun egiaztatzeko.', 'textarea' ),
|
||||
),
|
||||
),
|
||||
|
||||
/* ================= Portada ================= */
|
||||
'hero' => array(
|
||||
'panel' => 'ga_home',
|
||||
'title' => 'Portada principal y «puertas»',
|
||||
'title' => 'Portada principal',
|
||||
'section' => true,
|
||||
'fields' => array_merge(
|
||||
array(
|
||||
@@ -208,65 +261,42 @@ function ga_customizer_registry() {
|
||||
'full' => 'Foto o vídeo a pantalla completa',
|
||||
'split' => 'Texto a la izquierda, foto a la derecha',
|
||||
) ),
|
||||
'image' => array( 'type' => 'image', 'label' => 'Foto', 'default' => 0 ),
|
||||
'video' => array( 'type' => 'video', 'label' => 'Vídeo de fondo (opcional, MP4 corto y sin sonido)', 'default' => 0, 'description' => 'Se reproduce en bucle. La foto se muestra mientras carga.' ),
|
||||
'overlay' => array( 'type' => 'range', 'label' => 'Velo de color sobre la foto (%)', 'default' => 70, 'min' => 0, 'max' => 95, 'step' => 5 ),
|
||||
'eyebrow' => $t( 'Etiqueta superior', 'Protectora de animales · Hondarribia', 'Animalien babeslekua · Hondarribia' ),
|
||||
'title' => $t( 'Título (pon *entre asteriscos* la parte resaltada)', 'Tu mejor amigo *te está esperando*', 'Zure lagunik onena *zure zain dago*' ),
|
||||
'lead' => $t( 'Texto',
|
||||
'La mayoría nos conoce porque quiere adoptar. Pero adoptar es solo una de las cuatro puertas: acoger, echar una mano y donar son las que mantienen la primera abierta. Elige la que encaja con tu vida ahora.',
|
||||
'Gehienek adoptatu nahi dutelako ezagutzen gaituzte. Baina adoptatzea lau ateetako bat baino ez da: harrera egitea, laguntzea eta dohaintzak egitea dira lehena irekita mantentzen dutenak. Aukeratu orain zure bizitzara hobekien egokitzen dena.', 'textarea' ),
|
||||
'btn1' => $t( 'Botón 1', 'Ver quién está disponible', 'Ikusi nor dagoen zain' ),
|
||||
'btn1_url' => array( 'type' => 'text', 'label' => 'Botón 1 · enlace (vacío = listado de adopción)', 'default' => '' ),
|
||||
'btn2' => $t( 'Botón 2', 'Planifica tu visita', 'Antolatu zure bisita' ),
|
||||
'btn2_url' => array( 'type' => 'text', 'label' => 'Botón 2 · enlace (vacío = página de contacto)', 'default' => '' ),
|
||||
'doors' => array( 'type' => 'checkbox', 'label' => 'Mostrar las cuatro «puertas» bajo la portada', 'default' => true ),
|
||||
'image' => array( 'type' => 'image', 'label' => 'Foto (real, de vuestros animales)', 'default' => 0 ),
|
||||
'video' => array( 'type' => 'video', 'label' => 'Vídeo de fondo (opcional, MP4 corto y sin sonido)', 'default' => 0 ),
|
||||
'overlay' => array( 'type' => 'range', 'label' => 'Velo de color sobre la foto (%)', 'default' => 55, 'min' => 0, 'max' => 95, 'step' => 5 ),
|
||||
'eyebrow' => $t( 'Etiqueta superior (vacío = ocultar)', 'Protectora de animales · Hondarribia', 'Animalien babeslekua · Hondarribia' ),
|
||||
'title' => $t( 'Título (pon *entre asteriscos* la parte resaltada)', 'Su próxima oportunidad *puede empezar contigo*', 'Haren hurrengo aukera *zurekin has daiteke*' ),
|
||||
'lead' => $t( 'Texto', 'Conoce a los perros y gatos de Bilagun que están esperando una familia.', 'Ezagutu familia baten zain dauden Bilaguneko txakur eta katuak.', 'textarea' ),
|
||||
'btn1' => $t( 'Botón 1', 'Conoce a nuestros perros', 'Ezagutu gure txakurrak' ),
|
||||
'btn1_url' => array( 'type' => 'text', 'label' => 'Botón 1 · enlace (vacío = perros)', 'default' => '' ),
|
||||
'btn2' => $t( 'Botón 2', 'Conoce a nuestros gatos', 'Ezagutu gure katuak' ),
|
||||
'btn2_url' => array( 'type' => 'text', 'label' => 'Botón 2 · enlace (vacío = gatos)', 'default' => '' ),
|
||||
'doors' => array( 'type' => 'checkbox', 'label' => 'Mostrar cuatro accesos («puertas») bajo la portada', 'default' => false ),
|
||||
),
|
||||
$door( 1, array( 'Adopta', 'Adoptatu' ), array( 'Conócelos', 'Ezagutu' ), array( 'Perros y gatos que buscan una familia para siempre.', 'Betiko familia bila dabiltzan txakur eta katuak.' ), array( 'Ver animales', 'Ikusi animaliak' ) ),
|
||||
$door( 2, array( 'Acoge', 'Harrera' ), array( 'Abre tu casa', 'Ireki etxea' ), array( 'Un hogar temporal mientras encuentran su familia.', 'Aldi baterako etxe bat, familia aurkitu bitartean.' ), array( 'Quiero acoger', 'Harrera egin nahi dut' ) ),
|
||||
$door( 3, array( 'Voluntariado', 'Boluntariotza' ), array( 'Echa una mano', 'Eman esku bat' ), array( 'Paseos, mimos, fotos y ayuda en jornadas.', 'Ibilaldiak, laztanak, argazkiak eta laguntza jardunaldietan.' ), array( 'Apúntate', 'Eman izena' ) ),
|
||||
$door( 4, array( 'Dona', 'Dohaintza' ), array( 'Colabora', 'Lagundu' ), array( 'Pienso, mantas, material o una aportación.', 'Pentsua, mantak, materiala edo ekarpen bat.' ), array( 'Cómo donar', 'Nola eman' ) )
|
||||
$door( 1, array( 'Adopta', 'Adoptatu' ), array( 'Conócelos', 'Ezagutu' ), array( 'Perros y gatos que buscan una familia.', 'Familia bila dabiltzan txakur eta katuak.' ), array( 'Ver animales', 'Ikusi animaliak' ) ),
|
||||
$door( 2, array( 'Acoge', 'Harrera' ), array( 'Abre tu casa', 'Ireki etxea' ), array( 'Un hogar temporal mientras encuentran familia.', 'Aldi baterako etxe bat, familia aurkitu bitartean.' ), array( 'Quiero acoger', 'Harrera egin nahi dut' ) ),
|
||||
$door( 3, array( 'Voluntariado', 'Boluntariotza' ), array( 'Echa una mano', 'Eman esku bat' ), array( 'Paseos, compañía y socialización.', 'Ibilaldiak, konpainia eta sozializazioa.' ), array( 'Quiero ser voluntario', 'Boluntario izan nahi dut' ) ),
|
||||
$door( 4, array( 'Ayuda material', 'Laguntza materiala' ), array( 'Colabora', 'Lagundu' ), array( 'Lo que necesitamos ahora.', 'Orain behar duguna.' ), array( 'Ver necesidades', 'Ikusi beharrak' ) )
|
||||
),
|
||||
),
|
||||
'animals' => array(
|
||||
'panel' => 'ga_home',
|
||||
'title' => 'Animales en adopción',
|
||||
'title' => 'Animales destacados',
|
||||
'section' => true,
|
||||
'fields' => array(
|
||||
'eyebrow' => $t( 'Antetítulo', 'Puerta uno · Adopta', 'Lehen atea · Adoptatu' ),
|
||||
'title' => $t( 'Título', 'Te están esperando', 'Zure zain daude' ),
|
||||
'text' => $t( 'Texto', 'Todos se entregan con microchip, vacunas al día y esterilizados. Si alguno te roba el corazón, escríbenos y te contamos todo sobre él.', 'Guztiak mikrotxiparekin, txertoak egunean eta antzututa ematen dira. Norbaitek bihotza lapurtzen badizu, idatzi iezaguzu eta dena kontatuko dizugu.', 'textarea' ),
|
||||
'button' => $t( 'Botón', 'Ver todos los animales', 'Ikusi animalia guztiak' ),
|
||||
'count' => array( 'type' => 'number', 'label' => 'Número de animales', 'default' => 8, 'min' => 2, 'max' => 24 ),
|
||||
'view' => array( 'type' => 'select', 'label' => 'Presentación', 'default' => 'carrusel', 'choices' => array(
|
||||
'carrusel' => 'Carrusel (se desliza)',
|
||||
'eyebrow' => $t( 'Antetítulo', 'Te están esperando', 'Zure zain daude' ),
|
||||
'title' => $t( 'Título', 'Conócelos', 'Ezagutu' ),
|
||||
'text' => $t( 'Texto', 'Algunos llevan tiempo esperando o necesitan un hogar especialmente adaptado a ellos.', 'Batzuk denbora daramate zain edo haientzat bereziki egokitutako etxe bat behar dute.', 'textarea' ),
|
||||
'button' => $t( 'Botón', 'Ver todos', 'Denak ikusi' ),
|
||||
'filter' => array( 'type' => 'select', 'label' => 'Qué animales mostrar', 'default' => 'destacados', 'choices' => array(
|
||||
'destacados' => 'Los marcados como «Destacado» (si no hay, los que llevan más tiempo)',
|
||||
'' => 'Los últimos disponibles',
|
||||
) ),
|
||||
'count' => array( 'type' => 'number', 'label' => 'Número de animales', 'default' => 4, 'min' => 1, 'max' => 24 ),
|
||||
'view' => array( 'type' => 'select', 'label' => 'Presentación', 'default' => 'rejilla', 'choices' => array(
|
||||
'rejilla' => 'Rejilla',
|
||||
'carrusel' => 'Carrusel (se desliza)',
|
||||
) ),
|
||||
'filter' => array( 'type' => 'select', 'label' => 'Qué animales mostrar', 'default' => '', 'choices' => array(
|
||||
'' => 'Todos los disponibles',
|
||||
'urgente,acogida' => 'Solo urgentes y los que buscan acogida',
|
||||
) ),
|
||||
),
|
||||
),
|
||||
'steps' => array(
|
||||
'panel' => 'ga_home',
|
||||
'title' => 'Cómo adoptar',
|
||||
'section' => true,
|
||||
'fields' => array_merge(
|
||||
array(
|
||||
'eyebrow' => $t( 'Antetítulo', 'Qué pasa después', 'Zer gertatzen da gero' ),
|
||||
'title' => $t( 'Título', 'Una adopción clara, paso a paso', 'Adopzio argia, urratsez urrats' ),
|
||||
'text' => $t( 'Texto', 'Queremos que la adopción salga bien para siempre. Por eso vamos sin prisas y te acompañamos en cada paso.', 'Adopzioak betirako ondo irtetea nahi dugu. Horregatik presarik gabe goaz eta urrats bakoitzean lagunduko dizugu.', 'textarea' ),
|
||||
),
|
||||
$step( 1, 'Escríbenos', 'Rellena el formulario o llámanos. Cuéntanos cómo es tu casa, tu día a día y qué animal buscas.',
|
||||
'Idatzi iezaguzu', 'Bete formularioa edo deitu iezaguzu. Kontaiguzu nolakoa den zure etxea, zure eguneroko bizitza eta zer animalia bilatzen duzun.' ),
|
||||
$step( 2, 'Hablamos', 'Te llamamos para conocerte y resolver dudas. Es una conversación, no un examen.',
|
||||
'Hitz egingo dugu', 'Deituko dizugu zu ezagutzeko eta zalantzak argitzeko. Elkarrizketa bat da, ez azterketa bat.' ),
|
||||
$step( 3, 'Os conocéis', 'Ven a Jaizubia a conocerle. Paseos y visitas sin prisas, con toda la familia.',
|
||||
'Elkar ezagutu', 'Etorri Jaizubira hura ezagutzera. Ibilaldiak eta bisitak presarik gabe, familia osoarekin.' ),
|
||||
$step( 4, '¡A casa!', 'Firmamos el contrato de adopción y seguimos a tu lado para lo que necesites.',
|
||||
'Etxera!', 'Adopzio-kontratua sinatuko dugu eta behar duzun guztirako zure ondoan jarraituko dugu.' ),
|
||||
array( 'button' => $t( 'Botón', 'Quiero adoptar', 'Adoptatu nahi dut' ) )
|
||||
),
|
||||
),
|
||||
'foster' => array(
|
||||
@@ -274,62 +304,108 @@ function ga_customizer_registry() {
|
||||
'title' => 'Acogida',
|
||||
'section' => true,
|
||||
'fields' => array(
|
||||
'eyebrow' => $t( 'Antetítulo', 'Puerta dos · Acoge', 'Bigarren atea · Harrera' ),
|
||||
'title' => $t( 'Título', 'Acoger es lo que nos permite decir que sí', 'Harrera egiteak baietz esateko aukera ematen digu' ),
|
||||
'text' => $t( 'Texto', 'Cachorros, animales mayores o convalecientes necesitan salir del centro cuanto antes. Una casa de acogida les da tiempo y cariño mientras encuentran su familia definitiva.', 'Kumeek, animalia zaharrek edo gaixorik daudenek lehenbailehen irten behar dute zentrotik. Harrera-etxe batek denbora eta maitasuna ematen die behin betiko familia aurkitu bitartean.', 'textarea' ),
|
||||
'list_title' => $t( 'Título de la lista', 'Contigo en todo momento', 'Zurekin uneoro' ),
|
||||
'list' => $t( 'Lista (una línea por punto)',
|
||||
"Te explicamos qué necesita cada animal antes de llevarlo a casa\nResolvemos tus dudas durante toda la acogida\nBuscamos juntos su familia definitiva",
|
||||
"Etxera eraman aurretik animalia bakoitzak zer behar duen azaltzen dizugu\nHarrera osoan zehar zure zalantzak argitzen ditugu\nElkarrekin bilatzen dugu haren behin betiko familia", 'textarea' ),
|
||||
'image' => array( 'type' => 'image', 'label' => 'Foto', 'default' => 0 ),
|
||||
'caption' => $t( 'Pie de foto', '', '' ),
|
||||
'button' => $t( 'Botón', 'Quiero ser casa de acogida', 'Harrera-etxe izan nahi dut' ),
|
||||
'eyebrow' => $t( 'Antetítulo', 'Acoge', 'Harrera' ),
|
||||
'title' => $t( 'Título', 'Un hogar temporal *también puede cambiar una vida*', 'Aldi baterako etxe batek *ere bizitza bat alda dezake*' ),
|
||||
'text' => $t( 'Texto', 'Quizá ahora no puedas adoptar, pero sí ofrecer un hogar durante un tiempo. Escríbenos y te contamos qué animales necesitan acogida y cómo puedes ayudar.', 'Agian orain ezin duzu adoptatu, baina bai etxe bat eskaini denbora batez. Idatzi iezaguzu eta kontatuko dizugu zein animaliak behar duten harrera eta nola lagun dezakezun.', 'textarea' ),
|
||||
'list_title' => $t( 'Título de la lista (opcional)', '', '' ),
|
||||
'list' => $t( 'Lista (una línea por punto, opcional)', '', '', 'textarea' ),
|
||||
'image' => array( 'type' => 'image', 'label' => 'Foto', 'default' => 0 ),
|
||||
'caption' => $t( 'Pie de foto', '', '' ),
|
||||
'button' => $t( 'Botón', 'Quiero acoger', 'Harrera egin nahi dut' ),
|
||||
),
|
||||
),
|
||||
'about' => array(
|
||||
'panel' => 'ga_home',
|
||||
'title' => 'Quiénes somos y formas de ayudar',
|
||||
'section' => true,
|
||||
'fields' => array(
|
||||
'eyebrow' => $t( 'Antetítulo', 'Quiénes somos', 'Nor gara' ),
|
||||
'title' => $t( 'Título', 'Somos *Bilagun*', '*Bilagun* gara' ),
|
||||
'text' => $t( 'Texto', 'Somos la protectora de Jaizubia, en Hondarribia. Cuidamos de cada perro y cada gato como lo que es, un individuo con su historia, y buscamos para él una familia que encaje con su forma de ser.', 'Jaizubiko babeslekua gara, Hondarribian. Txakur eta katu bakoitza zaintzen dugu dena den bezala, bere istorioa duen norbait, eta bere izaerarekin bat datorren familia bat bilatzen diogu.', 'textarea' ),
|
||||
'image' => array( 'type' => 'image', 'label' => 'Foto (equipo o instalaciones)', 'default' => 0 ),
|
||||
'button' => $t( 'Botón', 'Conócenos', 'Ezagutu gaitzazu' ),
|
||||
'help_title' => $t( 'Formas de ayudar · título', 'Otras formas de ayudar', 'Laguntzeko beste modu batzuk' ),
|
||||
'help1' => $t( 'Ayuda 1 · voluntariado', 'Hazte voluntario/a', 'Egin boluntario' ),
|
||||
'help2' => $t( 'Ayuda 2 · material', 'Aporta material', 'Ekarri materiala' ),
|
||||
'help3' => $t( 'Ayuda 3 · compartir', 'Comparte sus historias', 'Partekatu haien istorioak' ),
|
||||
),
|
||||
),
|
||||
'talk' => array(
|
||||
'panel' => 'ga_home',
|
||||
'title' => 'Contacto',
|
||||
'section' => true,
|
||||
'fields' => array(
|
||||
'eyebrow' => $t( 'Antetítulo', 'Contacto', 'Harremanetarako' ),
|
||||
'title' => $t( 'Título', '¿Hablamos?', 'Hitz egingo dugu?' ),
|
||||
'text' => $t( 'Texto', '¿Te gustaría conocer a alguno de ellos? Escríbenos y te contamos un poquito más.', 'Haietako bat ezagutu nahiko zenuke? Idatzi iezaguzu eta zerbait gehiago kontatuko dizugu.', 'textarea' ),
|
||||
'form' => array( 'type' => 'checkbox', 'label' => 'Mostrar el formulario', 'default' => true ),
|
||||
'form_title' => $t( 'Título del formulario', 'Escríbenos', 'Idatzi iezaguzu' ),
|
||||
),
|
||||
),
|
||||
'steps' => array(
|
||||
'panel' => 'ga_home',
|
||||
'title' => 'Cómo adoptar (pasos)',
|
||||
'section' => true,
|
||||
'hidden' => true,
|
||||
'fields' => array_merge(
|
||||
array(
|
||||
'eyebrow' => $t( 'Antetítulo', 'Adopción', 'Adopzioa' ),
|
||||
'title' => $t( 'Título', '¿Cómo es el proceso?', 'Nolakoa da prozesua?' ),
|
||||
'text' => $t( 'Texto', '', '', 'textarea' ),
|
||||
),
|
||||
$step( 1, 'Primer contacto', 'Nos escribes y te enviamos nuestro cuestionario.', 'Lehen harremana', 'Idazten diguzu eta gure galdetegia bidaltzen dizugu.' ),
|
||||
$step( 2, 'Valoración', 'Lo valoramos con el equipo.', 'Balorazioa', 'Taldearekin baloratzen dugu.' ),
|
||||
$step( 3, 'Nos conocemos', 'Quedamos con cita previa para conoceros.', 'Elkar ezagutu', 'Aurretiko hitzorduarekin geratzen gara elkar ezagutzeko.' ),
|
||||
$step( 4, '', '', '', '' ),
|
||||
array( 'button' => $t( 'Botón', 'Ver animales', 'Ikusi animaliak' ) )
|
||||
),
|
||||
),
|
||||
'give' => array(
|
||||
'panel' => 'ga_home',
|
||||
'title' => 'Donaciones',
|
||||
'section' => true,
|
||||
'hidden' => true,
|
||||
'description' => 'Oculta hasta confirmar los medios de pago.',
|
||||
'fields' => array(
|
||||
'eyebrow' => $t( 'Antetítulo', 'Puerta cuatro · Dona', 'Laugarren atea · Dohaintza' ),
|
||||
'title' => $t( 'Título', 'Cada ayuda se nota', 'Laguntza oro nabaritzen da' ),
|
||||
'text' => $t( 'Texto', 'Con tu aportación compramos pienso, medicinas y todo lo que necesitan mientras esperan una familia.', 'Zure ekarpenarekin pentsua, sendagaiak eta familia baten zain dauden bitartean behar duten guztia erosten dugu.', 'textarea' ),
|
||||
'card_title' => $t( 'Tarjeta · título', 'Cómo donar', 'Nola eman' ),
|
||||
'card_text' => $t( 'Tarjeta · texto', 'Escríbenos y te indicamos cómo hacer una aportación económica o dónde traer material. ¡Gracias!', 'Idatzi iezaguzu eta diru-ekarpena nola egin edo materiala non ekarri azalduko dizugu. Eskerrik asko!', 'textarea' ),
|
||||
'shortcode' => array( 'type' => 'text', 'label' => 'Formulario de donación (opcional): pega aquí el shortcode de GiveWP, p. ej. [give_form id="12"]', 'default' => '' ),
|
||||
'button' => $t( 'Botón', 'Quiero donar', 'Dohaintza egin nahi dut' ),
|
||||
'needs_title' => $t( 'Necesidades · título', 'Lo que más necesitamos', 'Gehien behar duguna' ),
|
||||
'needs' => $t( 'Necesidades (una línea por punto)',
|
||||
"Pienso para perros y gatos\nArena para gatos\nMantas, toallas y camas\nCorreas, collares y juguetes",
|
||||
"Txakur eta katuentzako pentsua\nKatuentzako harea\nMantak, eskuoihalak eta oheak\nUhalak, lepokoak eta jostailuak", 'textarea' ),
|
||||
'eyebrow' => $t( 'Antetítulo', 'Donaciones', 'Dohaintzak' ),
|
||||
'title' => $t( 'Título', 'Tu ayuda se nota', 'Zure laguntza nabaritzen da' ),
|
||||
'text' => $t( 'Texto', '', '', 'textarea' ),
|
||||
'card_title' => $t( 'Tarjeta · título', 'Cómo donar', 'Nola eman' ),
|
||||
'card_text' => $t( 'Tarjeta · texto', '', '', 'textarea' ),
|
||||
'shortcode' => array( 'type' => 'text', 'label' => 'Formulario de donación (opcional): shortcode de GiveWP, p. ej. [give_form id="12"]', 'default' => '' ),
|
||||
'button' => $t( 'Botón', 'Quiero ayudar', 'Lagundu nahi dut' ),
|
||||
'needs_title' => $t( 'Necesidades · título', '', '' ),
|
||||
'needs' => $t( 'Necesidades (una línea por punto)', '', '', 'textarea' ),
|
||||
),
|
||||
),
|
||||
'stats' => array(
|
||||
'panel' => 'ga_home',
|
||||
'title' => 'Cifras',
|
||||
'section' => true,
|
||||
'hidden' => true,
|
||||
'fields' => array(
|
||||
'eyebrow' => $t( 'Antetítulo', 'Nuestro impacto', 'Gure eragina' ),
|
||||
'title' => $t( 'Título', 'Cada número es una vida', 'Zenbaki bakoitza bizitza bat da' ),
|
||||
'num1' => array( 'type' => 'text', 'label' => 'Cifra 1', 'default' => '+25' ),
|
||||
'label1' => $t( 'Cifra 1 · texto', 'años cuidando animales', 'urte animaliak zaintzen' ),
|
||||
'num2' => array( 'type' => 'text', 'label' => 'Cifra 2', 'default' => '2' ),
|
||||
'label2' => $t( 'Cifra 2 · texto', 'municipios: Irun y Hondarribia', 'udalerri: Irun eta Hondarribia' ),
|
||||
'num3' => array( 'type' => 'text', 'label' => 'Cifra 3', 'default' => '100%' ),
|
||||
'label3' => $t( 'Cifra 3 · texto', 'con microchip, vacunas y esterilización', 'mikrotxip, txerto eta antzutzearekin' ),
|
||||
'num4' => array( 'type' => 'text', 'label' => 'Cifra 4 (vacío = ocultar)', 'default' => '' ),
|
||||
'eyebrow' => $t( 'Antetítulo', 'Nuestro trabajo', 'Gure lana' ),
|
||||
'title' => $t( 'Título', 'En cifras', 'Zenbakitan' ),
|
||||
'num1' => array( 'type' => 'text', 'label' => 'Cifra 1', 'default' => '' ),
|
||||
'label1' => $t( 'Cifra 1 · texto', '', '' ),
|
||||
'num2' => array( 'type' => 'text', 'label' => 'Cifra 2', 'default' => '' ),
|
||||
'label2' => $t( 'Cifra 2 · texto', '', '' ),
|
||||
'num3' => array( 'type' => 'text', 'label' => 'Cifra 3', 'default' => '' ),
|
||||
'label3' => $t( 'Cifra 3 · texto', '', '' ),
|
||||
'num4' => array( 'type' => 'text', 'label' => 'Cifra 4', 'default' => '' ),
|
||||
'label4' => $t( 'Cifra 4 · texto', '', '' ),
|
||||
),
|
||||
),
|
||||
'stories' => array(
|
||||
'panel' => 'ga_home',
|
||||
'title' => 'Historias con final feliz',
|
||||
'title' => 'Finales felices',
|
||||
'section' => true,
|
||||
'description' => 'Muestra automáticamente los últimos animales marcados como «Adoptado». Si no hay ninguno, la sección no aparece.',
|
||||
'hidden' => true,
|
||||
'description' => 'Muestra automáticamente los animales marcados como «Adoptado».',
|
||||
'fields' => array(
|
||||
'eyebrow' => $t( 'Antetítulo', 'Ya están en casa', 'Etxean daude jada' ),
|
||||
'title' => $t( 'Título', 'Historias con final feliz', 'Amaiera zoriontsuko istorioak' ),
|
||||
'text' => $t( 'Texto', 'Gracias a las familias que les abrieron su casa.', 'Eskerrik asko etxeko ateak ireki zizkieten familiei.', 'textarea' ),
|
||||
'title' => $t( 'Título', 'Finales felices', 'Amaiera zoriontsuak' ),
|
||||
'text' => $t( 'Texto', 'Gracias por formar parte de sus segundas oportunidades.', 'Eskerrik asko haien bigarren aukeren parte izateagatik.', 'textarea' ),
|
||||
'count' => array( 'type' => 'number', 'label' => 'Número de animales', 'default' => 8, 'min' => 1, 'max' => 24 ),
|
||||
'view' => array( 'type' => 'select', 'label' => 'Presentación', 'default' => 'carrusel', 'choices' => array(
|
||||
'carrusel' => 'Carrusel (se desliza)',
|
||||
@@ -339,41 +415,34 @@ function ga_customizer_registry() {
|
||||
),
|
||||
'intake' => array(
|
||||
'panel' => 'ga_home',
|
||||
'title' => 'Si necesitas ayuda (perdidos, encontrados…)',
|
||||
'title' => 'Animales perdidos o encontrados',
|
||||
'section' => true,
|
||||
'hidden' => true,
|
||||
'fields' => array_merge(
|
||||
array(
|
||||
'eyebrow' => $t( 'Antetítulo', 'Si eres tú quien necesita ayuda', 'Laguntza behar duzuna zu bazara' ),
|
||||
'title' => $t( 'Título', 'Perdidos, encontrados y entregas', 'Galduak, aurkituak eta entregak' ),
|
||||
'eyebrow' => $t( 'Antetítulo', 'Si necesitas ayuda', 'Laguntza behar baduzu' ),
|
||||
'title' => $t( 'Título', 'Perdidos y encontrados', 'Galduak eta aurkituak' ),
|
||||
),
|
||||
$card( 'caso', 1, array( 'He perdido a mi animal', 'Nire animalia galdu dut' ),
|
||||
array( 'Llámanos cuanto antes y avisa a la Policía Municipal. Los animales que se recogen en Irun y Hondarribia llegan a nuestras instalaciones: el microchip actualizado es la forma más rápida de volver a casa.',
|
||||
'Deitu iezaguzu lehenbailehen eta jakinarazi Udaltzaingoari. Irunen eta Hondarribian jasotzen diren animaliak gure instalazioetara iristen dira: mikrotxipa eguneratuta izatea da etxera itzultzeko modurik azkarrena.' ) ),
|
||||
$card( 'caso', 2, array( 'He encontrado un animal', 'Animalia bat aurkitu dut' ),
|
||||
array( 'Si está en la calle en Irun u Hondarribia, avisa a la Policía Municipal: ellos lo recogen y lo traen a Gure Ametsa, donde pasa control veterinario y le buscamos a su familia.',
|
||||
'Irunen edo Hondarribian kalean badago, jakinarazi Udaltzaingoari: haiek jaso eta Gure Ametsara ekartzen dute, non albaitari-kontrola egiten zaion eta bere familia bilatzen diogun.' ) ),
|
||||
$card( 'caso', 3, array( 'No puedo seguir cuidándolo', 'Ezin dut gehiago zaindu' ),
|
||||
array( 'Escríbenos o llámanos antes de tomar una decisión. Te escucharemos sin juzgarte y buscaremos juntos la mejor salida para él.',
|
||||
'Idatzi edo deitu iezaguzu erabaki bat hartu aurretik. Epaitu gabe entzungo dizugu eta elkarrekin bilatuko dugu harentzat irtenbiderik onena.' ) )
|
||||
$card( 'caso', 1, array( '', '' ), array( '', '' ) ),
|
||||
$card( 'caso', 2, array( '', '' ), array( '', '' ) ),
|
||||
$card( 'caso', 3, array( '', '' ), array( '', '' ) )
|
||||
),
|
||||
),
|
||||
'faq' => array(
|
||||
'panel' => 'ga_home',
|
||||
'title' => 'Preguntas frecuentes',
|
||||
'section' => true,
|
||||
'hidden' => true,
|
||||
'description' => 'Las preguntas completas están en la página «Preguntas frecuentes», enlazada en el pie.',
|
||||
'fields' => array_merge(
|
||||
array(
|
||||
'eyebrow' => $t( 'Antetítulo', 'Dudas', 'Zalantzak' ),
|
||||
'title' => $t( 'Título', 'Preguntas frecuentes', 'Ohiko galderak' ),
|
||||
),
|
||||
$qa( 1, '¿Qué incluye la adopción?', 'Todos los animales se entregan con microchip, vacunas al día, desparasitados y esterilizados, como marca la Ley de Bienestar Animal.',
|
||||
'Zer barne hartzen du adopzioak?', 'Animalia guztiak mikrotxiparekin, txertoak egunean, desparasitatuta eta antzututa ematen dira, Animalien Ongizaterako Legeak agintzen duen bezala.' ),
|
||||
$qa( 2, '¿Puedo ir a conocerlos?', 'Sí. Estamos en Jaizubia, 44 (Hondarribia), de lunes a viernes de 10:00 a 13:00 y de 14:00 a 19:00. Llámanos antes para organizar la visita.',
|
||||
'Joan naiteke haiek ezagutzera?', 'Bai. Jaizubian gaude, 44 (Hondarribia), astelehenetik ostiralera 10:00etatik 13:00etara eta 14:00etatik 19:00etara. Deitu aurretik bisita antolatzeko.' ),
|
||||
$qa( 3, '¿Puedo ser casa de acogida o voluntario/a?', 'Sí, nos ayuda muchísimo. Escríbenos desde el formulario de contacto y te contamos cómo empezar.',
|
||||
'Harrera-etxe edo boluntario izan naiteke?', 'Bai, asko laguntzen digu. Idatzi iezaguzu harremanetarako formularioaren bidez eta nola hasi kontatuko dizugu.' ),
|
||||
$qa( 4, '¿Cuidáis de mi perro o gato en vacaciones?', 'Sí, tenemos hotel para perros y gatos. Consulta disponibilidad con antelación, sobre todo en verano.',
|
||||
'Nire txakurra edo katua zaintzen duzue oporretan?', 'Bai, txakur eta katuentzako hotela dugu. Galdetu erabilgarritasuna aldez aurretik, batez ere udan.' ),
|
||||
$qa( 1, '', '', '', '' ),
|
||||
$qa( 2, '', '', '', '' ),
|
||||
$qa( 3, '', '', '', '' ),
|
||||
$qa( 4, '', '', '', '' ),
|
||||
$qa( 5, '', '', '', '' )
|
||||
),
|
||||
),
|
||||
@@ -381,54 +450,18 @@ function ga_customizer_registry() {
|
||||
'panel' => 'ga_home',
|
||||
'title' => 'Contenido libre de la página «Inicio»',
|
||||
'section' => true,
|
||||
'description' => 'Lo que escribáis en la página Inicio (y en «Hasiera» para euskera) con el editor de bloques. Ideal para añadir patrones de «Gure Ametsa».',
|
||||
'hidden' => true,
|
||||
'description' => 'Lo que escribáis en la página Inicio (y en «Hasiera» para euskera) con el editor de bloques.',
|
||||
'fields' => array(),
|
||||
),
|
||||
'visit' => array(
|
||||
'panel' => 'ga_home',
|
||||
'title' => 'Hotel y visita',
|
||||
'section' => true,
|
||||
'fields' => array(
|
||||
'eyebrow' => $t( 'Antetítulo', 'Visítanos', 'Etorri gu ikustera' ),
|
||||
'title' => $t( 'Título', 'Estamos en Jaizubia', 'Jaizubian gaude' ),
|
||||
'text' => $t( 'Texto', 'Ven a conocer a los animales. Y si te vas de vacaciones, también cuidamos de tu perro o gato en nuestro hotel.', 'Etorri animaliak ezagutzera. Eta oporretara bazoaz, zure txakurra edo katua ere zaintzen dugu gure hotelean.', 'textarea' ),
|
||||
'image' => array( 'type' => 'image', 'label' => 'Foto del hotel o las instalaciones', 'default' => 0 ),
|
||||
'button' => $t( 'Botón del hotel', 'Hotel para perros y gatos', 'Txakur eta katuentzako hotela' ),
|
||||
),
|
||||
),
|
||||
'talk' => array(
|
||||
'panel' => 'ga_home',
|
||||
'title' => 'Contacto con formulario',
|
||||
'section' => true,
|
||||
'fields' => array(
|
||||
'eyebrow' => $t( 'Antetítulo', 'Hablemos', 'Hitz egin dezagun' ),
|
||||
'title' => $t( 'Título', 'Habla con una persona', 'Hitz egin pertsona batekin' ),
|
||||
'text' => $t( 'Texto', 'Adopciones, acogidas, voluntariado, hotel o un animal perdido: escríbenos y te responde alguien del equipo.', 'Adopzioak, harrerak, boluntariotza, hotela edo animalia galdu bat: idatzi iezaguzu eta taldeko norbaitek erantzungo dizu.', 'textarea' ),
|
||||
'form_title' => $t( 'Título del formulario', 'Escríbenos', 'Idatzi iezaguzu' ),
|
||||
),
|
||||
),
|
||||
'help' => array(
|
||||
'panel' => 'ga_home',
|
||||
'title' => 'Formas de ayudar (tarjetas)',
|
||||
'section' => true,
|
||||
'hidden' => true,
|
||||
'fields' => array(
|
||||
'eyebrow' => $t( 'Antetítulo', 'Colabora', 'Lagundu' ),
|
||||
'title' => $t( 'Título', 'Hay muchas formas de ayudar', 'Laguntzeko modu asko daude' ),
|
||||
'text' => $t( 'Texto', 'No hace falta adoptar para cambiar la vida de un animal.', 'Ez da beharrezkoa adoptatzea animalia baten bizitza aldatzeko.', 'textarea' ),
|
||||
),
|
||||
),
|
||||
'species' => array(
|
||||
'panel' => 'ga_home',
|
||||
'title' => 'Perros y gatos (accesos con foto)',
|
||||
'title' => 'Accesos a perros y gatos con foto',
|
||||
'section' => true,
|
||||
'hidden' => true,
|
||||
'description' => 'Usa las fotos de Adopción → Listado y fichas.',
|
||||
'fields' => array(
|
||||
'title' => $t( 'Título (vacío = ocultar)', '¿A quién vas a conocer hoy?', 'Nor ezagutuko duzu gaur?' ),
|
||||
'dog_label' => $t( 'Perros · texto', 'Conoce a los perros', 'Ezagutu txakurrak' ),
|
||||
'dog_image' => array( 'type' => 'image', 'label' => 'Perros · foto', 'default' => 0 ),
|
||||
'cat_label' => $t( 'Gatos · texto', 'Conoce a los gatos', 'Ezagutu katuak' ),
|
||||
'cat_image' => array( 'type' => 'image', 'label' => 'Gatos · foto', 'default' => 0 ),
|
||||
'title' => $t( 'Título (vacío = ocultar)', '¿A quién vas a conocer hoy?', 'Nor ezagutuko duzu gaur?' ),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
@@ -4,29 +4,59 @@ get_header();
|
||||
while ( have_posts() ) :
|
||||
the_post();
|
||||
$id = get_the_ID();
|
||||
$estado = ga_get( $id, 'estado' ) ?: 'disponible';
|
||||
$estado = ga_status( $id );
|
||||
$fields = ga_fields();
|
||||
$photos = ga_gallery_ids( $id );
|
||||
$species = get_the_terms( $id, 'especie' );
|
||||
$species = $species && ! is_wp_error( $species ) ? $species[0] : null;
|
||||
$facts = array_filter( array(
|
||||
ga__( 'Especie', 'Espeziea' ) => ga_species(),
|
||||
$fields['sexo']['label'] => ga_label( $id, 'sexo' ),
|
||||
$fields['edad']['label'] => ga_age( $id ),
|
||||
$fields['tamano']['label'] => ga_label( $id, 'tamano' ),
|
||||
$fields['raza']['label'] => ga_get( $id, 'raza' ),
|
||||
ga__( 'Llegó el', 'Iritsiera' ) => ga_label( $id, 'llegada' ),
|
||||
$fields['sexo']['label'] => ga_label( $id, 'sexo' ),
|
||||
ga__( 'Edad', 'Adina' ) => ga_age( $id ),
|
||||
$fields['nacimiento']['label'] => ga_label( $id, 'nacimiento' ),
|
||||
$fields['tamano']['label'] => ga_is_dog( $id ) ? ga_label( $id, 'tamano' ) : '',
|
||||
$fields['llegada']['label'] => ga_label( $id, 'llegada' ),
|
||||
) );
|
||||
$salud = ga_label( $id, 'salud' ) ?: array();
|
||||
$compatible = ga_label( $id, 'compatible' ) ?: array();
|
||||
$archive = get_post_type_archive_link( 'animal' );
|
||||
$texts = array_filter( array(
|
||||
'caracter' => ga_get( $id, 'caracter' ),
|
||||
'necesidades' => ga_get( $id, 'necesidades' ),
|
||||
'convivencia' => ga_get( $id, 'convivencia' ),
|
||||
'hogar' => ga_get( $id, 'hogar' ),
|
||||
) );
|
||||
$back = $species ? get_term_link( $species ) : get_post_type_archive_link( 'animal' );
|
||||
?>
|
||||
|
||||
<section class="ga-section" style="padding-top:48px">
|
||||
<section class="ga-section ga-section--tight">
|
||||
<div class="ga-wrap">
|
||||
<p><a href="<?php echo esc_url( $archive ); ?>"><?php ga_e( '← Todos los animales', '← Animalia guztiak' ); ?></a></p>
|
||||
<p class="ga-back"><a href="<?php echo esc_url( $back ); ?>">← <?php echo esc_html( $species ? ga_plural( $species->name ) : ga__( 'Adopta', 'Adoptatu' ) ); ?></a></p>
|
||||
|
||||
<article class="ga-animal">
|
||||
<div class="ga-animal__photo"><?php ga_animal_photo( 'ga-square' ); ?></div>
|
||||
<div>
|
||||
<div class="ga-animal__media">
|
||||
<div class="ga-animal__photo" data-ga-gallery-main>
|
||||
<?php if ( $photos ) : ?>
|
||||
<?php echo wp_get_attachment_image( $photos[0], 'ga-square', false, array( 'fetchpriority' => 'high' ) ); ?>
|
||||
<?php else : ?>
|
||||
<?php ga_animal_photo( 'ga-square' ); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if ( count( $photos ) > 1 ) : ?>
|
||||
<ul class="ga-thumbs" aria-label="<?php echo esc_attr( ga__( 'Más fotos', 'Argazki gehiago' ) ); ?>">
|
||||
<?php foreach ( $photos as $i => $photo ) : ?>
|
||||
<li>
|
||||
<button type="button" data-full="<?php echo esc_url( wp_get_attachment_image_url( $photo, 'ga-square' ) ); ?>"<?php echo 0 === $i ? ' aria-current="true"' : ''; ?> aria-label="<?php echo esc_attr( sprintf( ga__( 'Foto %d', '%d. argazkia' ), $i + 1 ) ); ?>">
|
||||
<?php echo wp_get_attachment_image( $photo, 'thumbnail', false, array( 'loading' => 'lazy', 'alt' => '' ) ); ?>
|
||||
</button>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
<?php if ( ga_get( $id, 'video' ) ) : ?>
|
||||
<div class="ga-video"><?php echo ga_video_html( ga_get( $id, 'video' ) ); // oEmbed o <video> escapado. ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="ga-animal__info">
|
||||
<?php ga_status_badge(); ?>
|
||||
<h1 style="margin-top:14px"><?php the_title(); ?></h1>
|
||||
<h1><?php the_title(); ?></h1>
|
||||
|
||||
<?php if ( $facts ) : ?>
|
||||
<ul class="ga-animal__facts">
|
||||
@@ -36,65 +66,42 @@ while ( have_posts() ) :
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $salud ) : ?>
|
||||
<ul class="ga-tags" aria-label="<?php echo esc_attr( $fields['salud']['label'] ); ?>">
|
||||
<?php foreach ( $salud as $s ) : ?><li><?php echo esc_html( $s ); ?></li><?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
<div class="ga-animal__story"><?php the_content(); ?></div>
|
||||
|
||||
<?php if ( $compatible ) : ?>
|
||||
<p><strong><?php echo esc_html( $fields['compatible']['label'] ); ?>:</strong> <?php echo esc_html( implode( ', ', $compatible ) ); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="ga-animal__content"><?php the_content(); ?></div>
|
||||
<?php foreach ( $texts as $key => $text ) : ?>
|
||||
<div class="ga-animal__block">
|
||||
<h2><?php echo esc_html( $fields[ $key ]['label'] ); ?></h2>
|
||||
<?php echo wpautop( esc_html( $text ) ); ?>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php if ( 'adoptado' === $estado ) : ?>
|
||||
<div class="ga-box">
|
||||
<h3><?php echo esc_html( ga__( '¡' . get_the_title() . ' ya tiene familia! 🎉', get_the_title() . ': familia du jada! 🎉' ) ); ?></h3>
|
||||
<p>
|
||||
<?php ga_e( 'Pero muchos otros siguen esperando.', 'Baina beste asko zain daude oraindik.' ); ?>
|
||||
<a href="<?php echo esc_url( $archive ); ?>"><?php ga_e( 'Conócelos aquí', 'Ezagutu hemen' ); ?></a>.
|
||||
</p>
|
||||
<h3><?php echo esc_html( ga__( '¡' . get_the_title() . ' ya tiene familia!', get_the_title() . ': familia du jada!' ) ); ?></h3>
|
||||
<p><?php ga_e( 'Gracias por formar parte de sus segundas oportunidades.', 'Eskerrik asko haien bigarren aukeren parte izateagatik.' ); ?>
|
||||
<a href="<?php echo esc_url( $back ); ?>"><?php ga_e( 'Conoce a los que siguen esperando', 'Ezagutu oraindik zain daudenak' ); ?></a>.</p>
|
||||
</div>
|
||||
<?php else : ?>
|
||||
<div class="ga-cta-box">
|
||||
<h3><?php echo esc_html( ga__( '¿Quieres conocer a ' . get_the_title() . '?', get_the_title() . ' ezagutu nahi duzu?' ) ); ?></h3>
|
||||
<p>
|
||||
<?php ga_e( 'Escríbenos y te contaremos todo sobre su carácter y cuidados.', 'Idatzi iezaguzu eta bere izaera eta zaintzari buruzko guztia kontatuko dizugu.' ); ?>
|
||||
<?php if ( 'acogida' === $estado ) { ga_e( 'Busca una casa de acogida temporal.', 'Aldi baterako harrera-etxe bat behar du.' ); } ?>
|
||||
</p>
|
||||
<a class="ga-btn" href="<?php echo esc_url( ga_adopt_url() ); ?>">
|
||||
<?php 'acogida' === $estado ? ga_e( 'Quiero acogerle', 'Harrera egin nahi diot' ) : ga_e( 'Quiero adoptarle', 'Adoptatu nahi dut' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
<details class="ga-meet" id="conocer"<?php echo isset( $_GET['enviado'] ) ? ' open' : ''; ?>>
|
||||
<summary class="ga-btn ga-btn--primary"><?php echo esc_html( ga_meet_label( $id ) ); ?></summary>
|
||||
<div class="ga-meet__panel">
|
||||
<?php if ( ga_opt( 'adopcion', 'form_intro' ) && ! isset( $_GET['enviado'] ) ) : ?>
|
||||
<p><?php ga_opt_e( 'adopcion', 'form_intro' ); ?></p>
|
||||
<?php endif; ?>
|
||||
<?php echo do_shortcode( '[ga_contacto animal="' . (int) $id . '"]' ); ?>
|
||||
</div>
|
||||
</details>
|
||||
<?php get_template_part( 'template-parts/adoption-process' ); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ga_opt( 'adopcion', 'share' ) ) : ?>
|
||||
<?php ga_share_links( $id ); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<?php
|
||||
$related = ga_query_animals( array( 'numero' => 4 ) );
|
||||
$related->posts = array_values( array_filter( $related->posts, fn( $p ) => $p->ID !== $id ) );
|
||||
$related->post_count = min( 3, count( $related->posts ) );
|
||||
if ( $related->post_count ) :
|
||||
?>
|
||||
<section class="ga-section ga-section--sand">
|
||||
<div class="ga-wrap">
|
||||
<h2><?php ga_e( 'También buscan hogar', 'Hauek ere etxe bila dabiltza' ); ?></h2>
|
||||
<div class="ga-grid">
|
||||
<?php
|
||||
while ( $related->have_posts() ) :
|
||||
$related->the_post();
|
||||
get_template_part( 'template-parts/animal-card' );
|
||||
endwhile;
|
||||
wp_reset_postdata();
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<?php
|
||||
endif;
|
||||
endwhile;
|
||||
|
||||
get_footer();
|
||||
|
||||
@@ -185,11 +185,22 @@ p { margin: 0 0 1.1em; }
|
||||
.ga-nav { margin-inline: auto; }
|
||||
.ga-nav ul { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 2px; }
|
||||
.ga-nav a {
|
||||
display: block; padding: 8px 13px; border-radius: 999px;
|
||||
color: var(--ga-ink); text-decoration: none; font-weight: 600; font-size: .96rem;
|
||||
display: block; padding: 8px 11px; border-radius: 999px; white-space: nowrap;
|
||||
color: var(--ga-ink); text-decoration: none; font-weight: 600; font-size: .95rem;
|
||||
}
|
||||
.ga-nav a:hover, .ga-nav .current-menu-item > a, .ga-nav .current_page_item > a { background: var(--ga-green-soft); color: var(--ga-green-dark); }
|
||||
.ga-nav-highlight .ga-nav .menu-item:first-child a { background: var(--ga-red); color: var(--ga-on-red); }
|
||||
.ga-nav-highlight .ga-nav .menu-item:first-child > a { background: var(--ga-red); color: var(--ga-on-red); }
|
||||
.ga-nav .menu-item-has-children { position: relative; }
|
||||
.ga-nav .menu-item-has-children > a::after { content: ""; display: inline-block; vertical-align: middle; width: 6px; height: 6px; margin-left: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-3px) rotate(45deg); opacity: .6; }
|
||||
.ga-nav .sub-menu {
|
||||
position: absolute; top: calc(100% + 6px); left: 0; min-width: 210px; z-index: 60;
|
||||
display: none; flex-direction: column; align-items: stretch; gap: 2px; padding: 8px;
|
||||
background: #fff; border: 1px solid var(--ga-line); border-radius: calc(var(--ga-radius) * .8); box-shadow: var(--ga-shadow);
|
||||
}
|
||||
.ga-nav .sub-menu::before { content: ""; position: absolute; inset: -10px 0 auto 0; height: 10px; }
|
||||
.ga-nav .menu-item-has-children:hover > .sub-menu,
|
||||
.ga-nav .menu-item-has-children:focus-within > .sub-menu { display: flex; }
|
||||
.ga-nav .sub-menu a { border-radius: 8px; white-space: nowrap; }
|
||||
|
||||
.ga-header__actions { display: flex; align-items: center; gap: 12px; flex: none; }
|
||||
.ga-header__phone { display: inline-flex; align-items: center; gap: 7px; color: var(--ga-green); font-weight: 700; text-decoration: none; font-size: .95rem; white-space: nowrap; }
|
||||
@@ -208,10 +219,10 @@ p { margin: 0 0 1.1em; }
|
||||
padding: 8px 14px; font: 700 .92rem var(--ga-sans); color: var(--ga-green); cursor: pointer;
|
||||
}
|
||||
|
||||
@media (max-width: 1180px) {
|
||||
@media (max-width: 1320px) {
|
||||
.ga-header__phone span { display: none; }
|
||||
}
|
||||
@media (max-width: 1060px) {
|
||||
@media (max-width: 1180px) {
|
||||
.ga-menu-toggle { display: inline-flex; }
|
||||
.ga-nav {
|
||||
position: absolute; inset: 100% 0 auto 0; margin: 0;
|
||||
@@ -221,6 +232,9 @@ p { margin: 0 0 1.1em; }
|
||||
.ga-nav.is-open { display: block; }
|
||||
.ga-nav ul { flex-direction: column; align-items: stretch; }
|
||||
.ga-nav a { padding: 12px 16px; font-size: 1.05rem; }
|
||||
.ga-nav .sub-menu { position: static; display: flex; box-shadow: none; border: 0; padding: 0 0 6px 16px; background: none; min-width: 0; }
|
||||
.ga-nav .sub-menu a { font-size: .98rem; padding: 8px 16px; color: var(--ga-muted); }
|
||||
.ga-nav .menu-item-has-children > a::after { display: none; }
|
||||
.ga-header__actions { margin-left: auto; }
|
||||
}
|
||||
@media (max-width: 640px) {
|
||||
@@ -282,7 +296,7 @@ body { overflow-x: clip; }
|
||||
.ga-hero--split .ga-btn--ghost:hover { background: var(--ga-green); color: var(--ga-on-primary); }
|
||||
.ga-hero__media img, .ga-hero__art { width: 100%; aspect-ratio: 4/5; object-fit: cover; border-radius: 240px 240px var(--ga-radius) var(--ga-radius); box-shadow: var(--ga-shadow); }
|
||||
.ga-hero__art { background: var(--ga-green); color: var(--ga-cream); display: grid; place-items: center; }
|
||||
.ga-hero__art svg { width: 55%; }
|
||||
.ga-hero__art svg { width: 62%; height: auto; }
|
||||
@media (max-width: 860px) {
|
||||
.ga-hero--split .ga-hero__inner { grid-template-columns: 1fr; }
|
||||
.ga-hero__media { max-width: 420px; }
|
||||
@@ -340,7 +354,7 @@ body { overflow-x: clip; }
|
||||
.ga-photo { margin: 0; }
|
||||
.ga-photo img, .ga-photo__placeholder { width: 100%; aspect-ratio: 3/2; object-fit: cover; border-radius: var(--ga-radius); box-shadow: var(--ga-shadow); }
|
||||
.ga-photo__placeholder { display: grid; place-items: center; background: var(--ga-green-soft); color: var(--ga-green); }
|
||||
.ga-photo__placeholder svg { width: 28%; opacity: .35; }
|
||||
.ga-photo__placeholder svg { width: 38%; height: auto; opacity: .45; }
|
||||
.ga-photo figcaption { margin-top: 10px; font-size: .85rem; color: var(--ga-muted); }
|
||||
|
||||
.ga-list-title { font-size: 1.25rem; margin-top: 28px; }
|
||||
@@ -416,7 +430,8 @@ body { overflow-x: clip; }
|
||||
.ga-species__tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s; z-index: -1; }
|
||||
.ga-species__tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 45%, rgba(0, 0, 0, .55)); z-index: -1; }
|
||||
.ga-species__tile:hover img { transform: scale(1.05); }
|
||||
.ga-species__paw { position: absolute; right: 8%; top: 12%; width: 32%; opacity: .2; }
|
||||
.ga-species__paw { position: absolute; right: 8%; top: 12%; width: 34%; opacity: .35; }
|
||||
.ga-species__paw svg { display: block; width: 100%; height: auto; }
|
||||
.ga-species__label { position: absolute; left: 24px; bottom: 22px; right: 24px; font: var(--ga-heading-weight) clamp(1.4rem, 3vw, 2.1rem)/1.1 var(--ga-serif); color: #fff; }
|
||||
@media (max-width: 640px) { .ga-species { grid-template-columns: 1fr; } .ga-species__tile { aspect-ratio: 2/1; } }
|
||||
|
||||
@@ -442,7 +457,7 @@ body { overflow-x: clip; }
|
||||
.ga-card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
|
||||
.ga-card:hover .ga-card__img img { transform: scale(1.04); }
|
||||
.ga-card__placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: var(--ga-green); }
|
||||
.ga-card__placeholder svg { width: 36%; opacity: .3; }
|
||||
.ga-card__placeholder svg { width: 46%; height: auto; opacity: .45; }
|
||||
.ga-card__body { padding: 16px 18px 18px; flex: 1; display: flex; flex-direction: column; }
|
||||
.ga-card__title { margin: 0 0 4px; font-size: 1.45rem; }
|
||||
.ga-card__title a { color: inherit; text-decoration: none; }
|
||||
@@ -535,6 +550,67 @@ body { overflow-x: clip; }
|
||||
.ga-animal__photo { position: static; }
|
||||
}
|
||||
|
||||
/* Pestañas Perros / Gatos */
|
||||
.ga-tabs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 28px; }
|
||||
.ga-tab { padding: 11px 26px; border-radius: 999px; border: 2px solid var(--ga-green); color: var(--ga-green); font-weight: 700; text-decoration: none; font-size: 1.05rem; }
|
||||
.ga-tab:hover { background: var(--ga-green-soft); color: var(--ga-green-dark); }
|
||||
.ga-tab.is-active { background: var(--ga-green); color: var(--ga-on-primary); }
|
||||
|
||||
/* Tarjeta detallada */
|
||||
.ga-card__excerpt { margin: 0; font-size: .95rem; color: var(--ga-muted); }
|
||||
.ga-card:not(.ga-card--detailed) .ga-card__body { padding: 14px 18px 16px; }
|
||||
.ga-card:not(.ga-card--detailed) .ga-card__title { margin: 0; }
|
||||
|
||||
/* Proceso de adopción */
|
||||
.ga-process { margin-top: 48px; padding: clamp(22px, 3vw, 32px); background: var(--ga-sand); border-radius: var(--ga-radius); }
|
||||
.ga-process h2 { font-size: 1.5rem; }
|
||||
.ga-process__steps { counter-reset: pr; list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
|
||||
.ga-process__steps li { counter-increment: pr; position: relative; padding-left: 46px; min-height: 32px; padding-top: 4px; }
|
||||
.ga-process__steps li::before { content: counter(pr); position: absolute; left: 0; top: 0; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--ga-green); color: var(--ga-on-primary); font: 800 .95rem var(--ga-serif); }
|
||||
.ga-process__note { margin: 16px 0 0; font-weight: 600; color: var(--ga-green-dark); }
|
||||
.ga-animal__info .ga-process { margin-top: 24px; }
|
||||
|
||||
/* Ficha: galería, vídeo, textos, formulario y compartir */
|
||||
.ga-back { margin-bottom: 24px; }
|
||||
.ga-back a { font-weight: 700; text-decoration: none; }
|
||||
.ga-animal__media { position: sticky; top: 110px; }
|
||||
.ga-animal__media .ga-animal__photo { position: static; }
|
||||
.ga-thumbs { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
|
||||
.ga-thumbs button { display: block; width: 100%; padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; cursor: pointer; background: none; aspect-ratio: 1; }
|
||||
.ga-thumbs button[aria-current="true"] { border-color: var(--ga-green); }
|
||||
.ga-thumbs img { width: 100%; height: 100%; object-fit: cover; }
|
||||
.ga-video { margin-top: 16px; border-radius: var(--ga-radius); overflow: hidden; }
|
||||
.ga-video iframe, .ga-video video { display: block; width: 100%; aspect-ratio: 16/9; height: auto; border: 0; }
|
||||
.ga-animal__info h1 { margin-top: 10px; }
|
||||
.ga-animal__story { font-size: 1.08rem; }
|
||||
.ga-animal__block h2 { font-size: 1.3rem; margin: 1.4em 0 .4em; }
|
||||
.ga-meet { margin-top: 32px; }
|
||||
.ga-meet > summary { list-style: none; width: 100%; font-size: 1.08rem; padding: 1em 1.5em; }
|
||||
.ga-meet > summary::-webkit-details-marker { display: none; }
|
||||
.ga-meet[open] > summary { border-radius: var(--ga-radius) var(--ga-radius) 0 0; }
|
||||
.ga-meet__panel { border: 2px solid var(--ga-green); border-top: 0; border-radius: 0 0 var(--ga-radius) var(--ga-radius); padding: 22px; background: #fff; }
|
||||
.ga-meet__panel .ga-form { margin-top: 0; }
|
||||
.ga-share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--ga-line); font-weight: 600; }
|
||||
.ga-share span { margin-right: 4px; }
|
||||
.ga-share__btn { padding: 7px 14px; border-radius: 999px; border: 1.5px solid var(--ga-line); background: #fff; color: var(--ga-ink); font: 600 .9rem var(--ga-sans); text-decoration: none; cursor: pointer; }
|
||||
.ga-share__btn:hover { border-color: var(--ga-green); color: var(--ga-green); }
|
||||
@media (max-width: 860px) { .ga-animal__media { position: static; } }
|
||||
|
||||
/* Cita previa, enlaces y necesidades */
|
||||
.ga-cita { display: flex; gap: 10px; align-items: flex-start; padding: 14px 18px; border-radius: calc(var(--ga-radius) * .7); background: var(--ga-red-soft); color: var(--ga-ink); font-weight: 600; }
|
||||
.ga-cita--dark { background: rgba(255, 255, 255, .08); color: #fff; }
|
||||
.ga-cita svg { margin-top: 3px; color: var(--ga-red); }
|
||||
.ga-linklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
|
||||
.ga-linklist a { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--ga-line); font-weight: 700; text-decoration: none; }
|
||||
.ga-social-inline { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 26px; }
|
||||
.ga-social-inline a { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
|
||||
.ga-needs-list { list-style: none; padding-left: 0 !important; display: grid; gap: 8px; }
|
||||
.ga-needs-list li { position: relative; padding-left: 1.8em; }
|
||||
.ga-needs-list li::before { content: "✓"; position: absolute; left: 0; font-weight: 800; color: var(--ga-red-dark); }
|
||||
.ga-needs-note { font-weight: 600; color: var(--ga-green-dark); }
|
||||
.ga-form__animal { margin: 0; font-weight: 700; }
|
||||
.ga-footer__cita { color: #fff; font-weight: 600; }
|
||||
|
||||
/* =========================================================================
|
||||
Formularios
|
||||
========================================================================= */
|
||||
@@ -617,7 +693,7 @@ ol.is-style-ga-pasos li::before {
|
||||
.ga-footer { border-top: 1px solid rgba(255, 255, 255, .08); background: var(--ga-footer-bg); color: color-mix(in srgb, #fff 72%, var(--ga-footer-bg)); padding: 72px 0 28px; font-size: .95rem; }
|
||||
.ga-footer a { color: #fff; text-decoration: none; }
|
||||
.ga-footer a:hover { text-decoration: underline; color: #fff; }
|
||||
.ga-footer__grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1.1fr; gap: 40px; }
|
||||
.ga-footer__grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr 1.3fr; gap: 36px; }
|
||||
.ga-footer h2 { color: #fff; font: 800 .76rem/1 var(--ga-sans); letter-spacing: .16em; text-transform: uppercase; margin-bottom: 1.4em; }
|
||||
.ga-footer ul { list-style: none; margin: 0; padding: 0; }
|
||||
.ga-footer li { margin-bottom: 10px; }
|
||||
@@ -631,14 +707,15 @@ ol.is-style-ga-pasos li::before {
|
||||
.ga-footer__bottom { margin-top: 56px; padding-top: 22px; border-top: 1px solid rgba(255, 255, 255, .14); display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; font-size: .85rem; }
|
||||
.ga-footer__bottom ul { display: flex; gap: 18px; }
|
||||
.ga-footer__bottom li { margin: 0; }
|
||||
@media (max-width: 960px) { .ga-footer__grid { grid-template-columns: 1fr 1fr; } }
|
||||
@media (max-width: 1080px) { .ga-footer__grid { grid-template-columns: repeat(3, 1fr); } .ga-footer__about { grid-column: 1 / -1; } }
|
||||
@media (max-width: 760px) { .ga-footer__grid { grid-template-columns: 1fr 1fr; } }
|
||||
@media (max-width: 560px) { .ga-footer__grid { grid-template-columns: 1fr; } }
|
||||
|
||||
/* =========================================================================
|
||||
Varios
|
||||
========================================================================= */
|
||||
.ga-404 { text-align: center; padding: 110px 0; }
|
||||
.ga-404 svg { width: 90px; margin: 0 auto 20px; color: var(--ga-green); }
|
||||
.ga-404 svg { width: 120px; height: auto; margin: 0 auto 24px; display: block; }
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
*, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/* Explicación del proceso de adopción (Personalizar → Adopción y colabora). */
|
||||
$steps = ga_lines( ga_opt( 'adopcion', 'process' ) );
|
||||
if ( ! $steps ) {
|
||||
return;
|
||||
}
|
||||
?>
|
||||
<div class="ga-process">
|
||||
<h2><?php ga_opt_e( 'adopcion', 'process_title' ); ?></h2>
|
||||
<ol class="ga-process__steps">
|
||||
<?php foreach ( $steps as $step ) : ?>
|
||||
<li><?php echo esc_html( $step ); ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
<?php if ( ga_opt( 'adopcion', 'process_note' ) ) : ?>
|
||||
<p class="ga-process__note"><?php ga_opt_e( 'adopcion', 'process_note' ); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
@@ -1,30 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* Tarjeta de animal (dentro del loop).
|
||||
* Tarjeta de animal (dentro del loop). Por defecto solo foto y nombre;
|
||||
* «detallada» añade edad y frase corta (Personalizar → Adopción).
|
||||
*/
|
||||
$id = get_the_ID();
|
||||
$meta = array_filter( array(
|
||||
ga_get( $id, 'raza' ) ?: ga_species(),
|
||||
ga_age( $id ),
|
||||
ga_label( $id, 'tamano' ),
|
||||
) );
|
||||
$compatible = ga_label( $id, 'compatible' ) ?: array();
|
||||
$id = get_the_ID();
|
||||
$detailed = 'detallada' === ga_opt( 'adopcion', 'card' );
|
||||
?>
|
||||
<article class="ga-card">
|
||||
<?php ga_status_badge(); ?>
|
||||
<article class="ga-card<?php echo $detailed ? ' ga-card--detailed' : ''; ?>">
|
||||
<?php if ( ga_opt( 'adopcion', 'card_status' ) ) : ?>
|
||||
<?php ga_status_badge(); ?>
|
||||
<?php endif; ?>
|
||||
<div class="ga-card__img"><?php ga_animal_photo(); ?></div>
|
||||
<div class="ga-card__body">
|
||||
<h3 class="ga-card__title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
|
||||
<?php if ( $meta ) : ?>
|
||||
<p class="ga-card__meta"><?php echo esc_html( implode( ' · ', $meta ) ); ?></p>
|
||||
<?php if ( $detailed ) : ?>
|
||||
<?php if ( ga_age( $id ) ) : ?>
|
||||
<p class="ga-card__meta"><?php echo esc_html( ga_age( $id ) ); ?></p>
|
||||
<?php endif; ?>
|
||||
<?php if ( has_excerpt() ) : ?>
|
||||
<p class="ga-card__excerpt"><?php echo esc_html( get_the_excerpt() ); ?></p>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php if ( $compatible ) : ?>
|
||||
<ul class="ga-badges">
|
||||
<?php foreach ( $compatible as $c ) : ?>
|
||||
<li><?php echo esc_html( ga_compat_label( $c ) ); ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
<span class="ga-card__more"><?php ga_e( 'Ver ficha', 'Ikusi fitxa' ); ?> <?php echo ga_icon( 'arrow' ); ?></span>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
34
wp-content/themes/gure-ametsa/template-parts/home/about.php
Normal file
34
wp-content/themes/gure-ametsa/template-parts/home/about.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
$image = (int) ga_opt( 'about', 'image' );
|
||||
$colabora = ga_page_url( 'colabora' );
|
||||
$helps = array_filter( array(
|
||||
array( ga_opt( 'about', 'help1' ), $colabora . '#voluntariado' ),
|
||||
array( ga_opt( 'about', 'help2' ), $colabora . '#material' ),
|
||||
array( ga_opt( 'about', 'help3' ), get_post_type_archive_link( 'animal' ) ),
|
||||
), fn( $h ) => '' !== trim( (string) $h[0] ) );
|
||||
?>
|
||||
<section class="ga-section" id="bilagun">
|
||||
<div class="ga-wrap ga-split">
|
||||
<figure class="ga-photo">
|
||||
<?php if ( $image ) : ?>
|
||||
<?php echo wp_get_attachment_image( $image, 'large', false, array( 'loading' => 'lazy' ) ); ?>
|
||||
<?php else : ?>
|
||||
<div class="ga-photo__placeholder"><?php echo ga_placeholder_svg(); ?></div>
|
||||
<?php endif; ?>
|
||||
</figure>
|
||||
<div>
|
||||
<?php ga_section_head( 'about' ); ?>
|
||||
<?php if ( ga_opt( 'about', 'button' ) ) : ?>
|
||||
<p><a class="ga-btn ga-btn--primary" href="<?php echo esc_url( ga_page_url( 'quienes-somos' ) ); ?>"><?php ga_opt_e( 'about', 'button' ); ?> <?php echo ga_icon( 'arrow' ); ?></a></p>
|
||||
<?php endif; ?>
|
||||
<?php if ( $helps ) : ?>
|
||||
<h3 class="ga-list-title"><?php ga_opt_e( 'about', 'help_title' ); ?></h3>
|
||||
<ul class="ga-linklist">
|
||||
<?php foreach ( $helps as [ $label, $href ] ) : ?>
|
||||
<li><a href="<?php echo esc_url( $href ); ?>"><?php echo esc_html( $label ); ?> <?php echo ga_icon( 'arrow' ); ?></a></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -8,9 +8,9 @@ $button = ga_opt( 'animals', 'button' )
|
||||
<?php ga_section_head( 'animals', array( 'extra' => $button ) ); ?>
|
||||
<?php
|
||||
echo do_shortcode( sprintf(
|
||||
'[ga_animales numero="%d" estado="%s" vista="%s"]',
|
||||
'[ga_animales numero="%d" destacados="%s" vista="%s"]',
|
||||
max( 1, (int) ga_opt( 'animals', 'count' ) ),
|
||||
esc_attr( ga_opt( 'animals', 'filter' ) ),
|
||||
'destacados' === ga_opt( 'animals', 'filter' ) ? '1' : '',
|
||||
esc_attr( ga_opt( 'animals', 'view' ) )
|
||||
) );
|
||||
?>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
$image = (int) ga_opt( 'foster', 'image' );
|
||||
$items = ga_lines( ga_opt( 'foster', 'list' ) );
|
||||
$url = add_query_arg( 'motivo', 'acogida', ga_page_url( 'contacto' ) ) . '#formulario';
|
||||
$url = ga_page_url( 'acoge' );
|
||||
?>
|
||||
<section class="ga-section" id="acogida">
|
||||
<section class="ga-section ga-section--sand" id="acogida">
|
||||
<div class="ga-wrap ga-split">
|
||||
<div>
|
||||
<?php ga_section_head( 'foster' ); ?>
|
||||
@@ -25,7 +25,7 @@ $url = add_query_arg( 'motivo', 'acogida', ga_page_url( 'contacto' ) ) . '#for
|
||||
<?php if ( $image ) : ?>
|
||||
<?php echo wp_get_attachment_image( $image, 'large', false, array( 'loading' => 'lazy' ) ); ?>
|
||||
<?php else : ?>
|
||||
<div class="ga-photo__placeholder"><?php echo ga_icon( 'paw' ); ?></div>
|
||||
<div class="ga-photo__placeholder"><?php echo ga_placeholder_svg(); ?></div>
|
||||
<?php endif; ?>
|
||||
<?php if ( ga_opt( 'foster', 'caption' ) ) : ?>
|
||||
<figcaption><?php ga_opt_e( 'foster', 'caption' ); ?></figcaption>
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
$colabora = ga_page_url( 'colabora' );
|
||||
$links = array(
|
||||
1 => get_post_type_archive_link( 'animal' ),
|
||||
2 => $colabora . '#acogida',
|
||||
2 => ga_page_url( 'acoge' ),
|
||||
3 => $colabora . '#voluntariado',
|
||||
4 => $colabora . '#donaciones',
|
||||
4 => $colabora . '#material',
|
||||
);
|
||||
?>
|
||||
<section class="ga-section ga-section--sand">
|
||||
|
||||
@@ -3,16 +3,16 @@ $image = (int) ga_opt( 'hero', 'image' );
|
||||
$video = (int) ga_opt( 'hero', 'video' );
|
||||
$full = 'full' === ga_opt( 'hero', 'layout' );
|
||||
$overlay = min( 95, (int) ga_opt( 'hero', 'overlay' ) ) / 100;
|
||||
$btn1 = ga_link( ga_opt( 'hero', 'btn1_url' ), get_post_type_archive_link( 'animal' ) );
|
||||
$btn2 = ga_link( ga_opt( 'hero', 'btn2_url' ), ga_page_url( 'contacto', '#formulario' ) );
|
||||
$btn1 = ga_link( ga_opt( 'hero', 'btn1_url' ), ga_species_url( 'perro' ) );
|
||||
$btn2 = ga_link( ga_opt( 'hero', 'btn2_url' ), ga_species_url( 'gato' ) );
|
||||
$doors = ga_opt( 'hero', 'doors' );
|
||||
|
||||
$colabora = ga_page_url( 'colabora' );
|
||||
$door_links = array(
|
||||
1 => get_post_type_archive_link( 'animal' ),
|
||||
2 => $colabora . '#acogida',
|
||||
2 => ga_page_url( 'acoge' ),
|
||||
3 => $colabora . '#voluntariado',
|
||||
4 => $colabora . '#donaciones',
|
||||
4 => $colabora . '#material',
|
||||
);
|
||||
|
||||
$classes = array( 'ga-hero', $full ? 'ga-hero--full' : 'ga-hero--split' );
|
||||
@@ -53,7 +53,7 @@ if ( $doors ) {
|
||||
<a class="ga-btn ga-btn--accent" href="<?php echo esc_url( $btn1 ); ?>"><?php ga_opt_e( 'hero', 'btn1' ); ?> <?php echo ga_icon( 'arrow' ); ?></a>
|
||||
<?php endif; ?>
|
||||
<?php if ( ga_opt( 'hero', 'btn2' ) ) : ?>
|
||||
<a class="ga-btn ga-btn--ghost" href="<?php echo esc_url( $btn2 ); ?>"><?php ga_opt_e( 'hero', 'btn2' ); ?></a>
|
||||
<a class="ga-btn ga-btn--ghost" href="<?php echo esc_url( $btn2 ); ?>"><?php ga_opt_e( 'hero', 'btn2' ); ?> <?php echo ga_icon( 'arrow' ); ?></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
@@ -63,7 +63,7 @@ if ( $doors ) {
|
||||
<?php if ( $image ) : ?>
|
||||
<?php echo wp_get_attachment_image( $image, 'large', false, array( 'fetchpriority' => 'high' ) ); ?>
|
||||
<?php else : ?>
|
||||
<div class="ga-hero__art"><?php echo ga_icon( 'paw' ); ?></div>
|
||||
<div class="ga-hero__art"><?php echo ga_placeholder_svg(); ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
@@ -9,8 +9,8 @@ foreach ( array( 'dog' => 'perro', 'cat' => 'gato' ) as $key => $slug ) {
|
||||
}
|
||||
$tiles[ $key ] = array(
|
||||
'url' => $term && ! is_wp_error( $term ) ? get_term_link( $term ) : get_post_type_archive_link( 'animal' ),
|
||||
'label' => ga_opt( 'species', "{$key}_label" ),
|
||||
'image' => (int) ga_opt( 'species', "{$key}_image" ),
|
||||
'label' => ga_opt( 'adopcion', "{$key}_label" ),
|
||||
'image' => (int) ga_opt( 'adopcion', "{$key}_image" ),
|
||||
);
|
||||
}
|
||||
?>
|
||||
@@ -25,7 +25,7 @@ foreach ( array( 'dog' => 'perro', 'cat' => 'gato' ) as $key => $slug ) {
|
||||
<?php if ( $tile['image'] ) : ?>
|
||||
<?php echo wp_get_attachment_image( $tile['image'], 'large', false, array( 'loading' => 'lazy', 'alt' => '' ) ); ?>
|
||||
<?php else : ?>
|
||||
<span class="ga-species__paw"><?php echo ga_icon( 'paw' ); ?></span>
|
||||
<span class="ga-species__paw"><?php echo ga_placeholder_svg(); ?></span>
|
||||
<?php endif; ?>
|
||||
<span class="ga-species__label"><?php echo esc_html( $tile['label'] ); ?> <span aria-hidden="true">→</span></span>
|
||||
</a>
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
<?php $with_form = (bool) ga_opt( 'talk', 'form' ); ?>
|
||||
<section class="ga-section ga-section--dark" id="contacto">
|
||||
<div class="ga-wrap ga-talk">
|
||||
<div class="ga-wrap <?php echo $with_form ? 'ga-talk' : 'ga-narrow'; ?>">
|
||||
<div>
|
||||
<?php ga_section_head( 'talk' ); ?>
|
||||
<?php if ( ga_info( 'cita' ) ) : ?>
|
||||
<p class="ga-cita ga-cita--dark"><?php echo ga_icon( 'clock' ); ?> <span><?php echo esc_html( ga_info( 'cita' ) ); ?></span></p>
|
||||
<?php endif; ?>
|
||||
<ul class="ga-iconlist ga-iconlist--big">
|
||||
<?php if ( ga_info( 'telefono' ) ) : ?>
|
||||
<li><?php echo ga_icon( 'phone' ); ?><span><strong><?php ga_e( 'Teléfono', 'Telefonoa' ); ?></strong><a href="<?php echo esc_attr( ga_tel_link() ); ?>"><?php echo esc_html( ga_info( 'telefono' ) ); ?></a></span></li>
|
||||
@@ -9,17 +13,20 @@
|
||||
<?php if ( ga_info( 'email' ) ) : ?>
|
||||
<li><?php echo ga_icon( 'mail' ); ?><span><strong>Email</strong><a href="mailto:<?php echo esc_attr( ga_info( 'email' ) ); ?>"><?php echo esc_html( ga_info( 'email' ) ); ?></a></span></li>
|
||||
<?php endif; ?>
|
||||
<?php if ( ga_info( 'direccion' ) ) : ?>
|
||||
<li><?php echo ga_icon( 'pin' ); ?><span><strong><?php ga_e( 'Dirección', 'Helbidea' ); ?></strong><?php echo esc_html( ga_info( 'direccion' ) ); ?></span></li>
|
||||
<?php endif; ?>
|
||||
<?php if ( ga_info( 'horario' ) ) : ?>
|
||||
<li><?php echo ga_icon( 'clock' ); ?><span><strong><?php ga_e( 'Horario', 'Ordutegia' ); ?></strong><?php echo esc_html( ga_info( 'horario' ) ); ?></span></li>
|
||||
<li><?php echo ga_icon( 'clock' ); ?><span><strong><?php ga_e( 'Atención al público', 'Jendaurreko arreta' ); ?></strong><?php echo esc_html( ga_info( 'horario' ) ); ?></span></li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
<?php $social = ga_social_links( true ); ?>
|
||||
<?php if ( $social ) : ?>
|
||||
<div class="ga-social-inline"><?php echo $social; // Escapado en la función. ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="ga-panel ga-panel--form" id="formulario">
|
||||
<h3><?php ga_opt_e( 'talk', 'form_title' ); ?></h3>
|
||||
<?php echo do_shortcode( '[ga_contacto]' ); ?>
|
||||
</div>
|
||||
<?php if ( $with_form ) : ?>
|
||||
<div class="ga-panel ga-panel--form" id="formulario">
|
||||
<h3><?php ga_opt_e( 'talk', 'form_title' ); ?></h3>
|
||||
<?php echo do_shortcode( '[ga_contacto]' ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
$image = (int) ga_opt( 'visit', 'image' );
|
||||
?>
|
||||
<section class="ga-section ga-section--sand" id="visitanos">
|
||||
<div class="ga-wrap">
|
||||
<?php ga_section_head( 'visit' ); ?>
|
||||
<div class="ga-location">
|
||||
<div class="ga-location__photo">
|
||||
<?php if ( $image ) : ?>
|
||||
<?php echo wp_get_attachment_image( $image, 'large', false, array( 'loading' => 'lazy' ) ); ?>
|
||||
<?php else : ?>
|
||||
<div class="ga-photo__placeholder"><?php echo ga_icon( 'paw' ); ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<div class="ga-location__info">
|
||||
<h3><?php echo esc_html( ga_opt( 'header', 'brand_line1' ) . ' ' . ga_opt( 'header', 'brand_line2' ) ); ?></h3>
|
||||
<ul class="ga-iconlist">
|
||||
<?php if ( ga_info( 'direccion' ) ) : ?>
|
||||
<li><?php echo ga_icon( 'pin' ); ?><span><?php echo esc_html( ga_info( 'direccion' ) ); ?></span></li>
|
||||
<?php endif; ?>
|
||||
<?php if ( ga_info( 'horario' ) ) : ?>
|
||||
<li><?php echo ga_icon( 'clock' ); ?><span><?php echo esc_html( ga_info( 'horario' ) ); ?></span></li>
|
||||
<?php endif; ?>
|
||||
<?php if ( ga_info( 'telefono' ) ) : ?>
|
||||
<li><?php echo ga_icon( 'phone' ); ?><a href="<?php echo esc_attr( ga_tel_link() ); ?>"><?php echo esc_html( ga_info( 'telefono' ) ); ?></a></li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
<div class="ga-location__actions">
|
||||
<?php if ( ga_info( 'maps' ) ) : ?>
|
||||
<a class="ga-btn ga-btn--primary" href="<?php echo esc_url( ga_info( 'maps' ) ); ?>" target="_blank" rel="noopener"><?php ga_e( 'Cómo llegar', 'Nola iritsi' ); ?> <?php echo ga_icon( 'arrow' ); ?></a>
|
||||
<?php endif; ?>
|
||||
<?php if ( ga_opt( 'visit', 'button' ) ) : ?>
|
||||
<a class="ga-btn ga-btn--outline" href="<?php echo esc_url( ga_page_url( 'hotel' ) ); ?>"><?php ga_opt_e( 'visit', 'button' ); ?></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
Reference in New Issue
Block a user