diff --git a/docker/content/es/preguntas-frecuentes.html b/docker/content/es/preguntas-frecuentes.html
index e685634..7ed278a 100644
--- a/docker/content/es/preguntas-frecuentes.html
+++ b/docker/content/es/preguntas-frecuentes.html
@@ -34,6 +34,12 @@
+
+ Avisa a la Policía Municipal de tu localidad y consulta el buscador de mascotas perdidas del Gobierno Vasco. Si es en Irun u Hondarribia, escríbenos o llámanos también.He perdido o he encontrado un animal, ¿qué hago?
+
¿No encuentras tu respuesta? Escríbenos.
diff --git a/docker/content/eu/ohiko-galderak.html b/docker/content/eu/ohiko-galderak.html index 47b796a..5dc9cd8 100644 --- a/docker/content/eu/ohiko-galderak.html +++ b/docker/content/eu/ohiko-galderak.html @@ -34,6 +34,12 @@ + +Jakinarazi zure herriko Udaltzaingoari eta kontsultatu Eusko Jaurlaritzaren maskota galduen bilatzailea. Irunen edo Hondarribian bada, idatzi edo deitu iezaguzu ere.
+Ez duzu zure erantzuna aurkitzen? Idatzi iezaguzu.
diff --git a/docker/setup.sh b/docker/setup.sh index 451c902..9f99958 100644 --- a/docker/setup.sh +++ b/docker/setup.sh @@ -183,4 +183,11 @@ if (( VERSION < 5 )); then wp_ option update ga_setup_version 5 fi +# Etapa 6: preguntas frecuentes con perdidos/encontrados (solo si la página no se ha editado) +if (( VERSION < 6 )); then + log "Migración 6: contenido" + GA_SEED_MENUS=false wp_ eval-file "$SRC/setup-content.php" || log "Fallo en la migración 6" + wp_ option update ga_setup_version 6 +fi + log "Configuración completada" diff --git a/wp-content/mu-plugins/gure-ametsa-core.php b/wp-content/mu-plugins/gure-ametsa-core.php index 4ff3e20..b1f9ba8 100644 --- a/wp-content/mu-plugins/gure-ametsa-core.php +++ b/wp-content/mu-plugins/gure-ametsa-core.php @@ -14,3 +14,4 @@ require_once __DIR__ . '/gure-ametsa/forms.php'; require_once __DIR__ . '/gure-ametsa/api.php'; require_once __DIR__ . '/gure-ametsa/admin.php'; require_once __DIR__ . '/gure-ametsa/share.php'; +require_once __DIR__ . '/gure-ametsa/seo.php'; diff --git a/wp-content/mu-plugins/gure-ametsa/forms.php b/wp-content/mu-plugins/gure-ametsa/forms.php index 3f26be6..12d370a 100644 --- a/wp-content/mu-plugins/gure-ametsa/forms.php +++ b/wp-content/mu-plugins/gure-ametsa/forms.php @@ -9,6 +9,7 @@ defined( 'ABSPATH' ) || exit; function ga_contact_reasons() { return array( 'adopcion' => ga__( 'Adopción', 'Adopzioa' ), + 'visita' => ga__( 'Pedir cita para una visita', 'Bisita baterako hitzordua eskatu' ), 'acogida' => ga__( 'Casa de acogida', 'Harrera-etxea' ), 'voluntario' => ga__( 'Voluntariado', 'Boluntariotza' ), 'material' => ga__( 'Ayuda material', 'Laguntza materiala' ), @@ -74,6 +75,11 @@ add_shortcode( 'ga_contacto', function ( $atts ) { + + + @@ -124,6 +130,7 @@ function ga_handle_contact() { 'telefono' => sanitize_text_field( wp_unslash( $_POST['telefono'] ?? '' ) ), 'motivo' => $reasons[ $reason ] ?? $reasons['otro'], 'mensaje' => sanitize_textarea_field( wp_unslash( $_POST['mensaje'] ?? '' ) ), + 'visita' => 'visita' === $reason ? sanitize_text_field( wp_unslash( $_POST['preferencia'] ?? '' ) ) : '', 'idioma' => 'eu' === ( $_POST['idioma'] ?? '' ) ? 'Euskera' : 'Castellano', ); $message_required = ! $animal; @@ -135,8 +142,9 @@ function ga_handle_contact() { ? 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", + "Nombre: %s\nEmail: %s\nTeléfono: %s\nMotivo: %s%s\nAnimal: %s\nIdioma: %s\n\n%s", $data['nombre'], $data['email'], $data['telefono'] ?: '-', $data['motivo'], + $data['visita'] ? "\nPreferencia de cita: " . $data['visita'] : '', $animal ? $animal . ' — ' . get_permalink( $animal_id ) : '-', $data['idioma'], $data['mensaje'] ?: '(sin mensaje)' ); diff --git a/wp-content/mu-plugins/gure-ametsa/seo.php b/wp-content/mu-plugins/gure-ametsa/seo.php new file mode 100644 index 0000000..fe2ac8d --- /dev/null +++ b/wp-content/mu-plugins/gure-ametsa/seo.php @@ -0,0 +1,50 @@ + 'PostalAddress', 'addressCountry' => 'ES' ); + if ( preg_match( '/^(.+?)\s*·\s*(\d{5})\s+(.+?)(?:\s*\((.+)\))?$/u', $raw, $m ) ) { + $address += array_filter( array( + 'streetAddress' => trim( $m[1] ), + 'postalCode' => $m[2], + 'addressLocality' => trim( $m[3] ), + 'addressRegion' => $m[4] ?? '', + ) ); + } else { + $address['streetAddress'] = $raw; + } + return $address; +} + +add_action( 'wp_head', function () { + if ( ! is_front_page() ) { + return; + } + $hours = array_filter( array_map( 'trim', explode( ',', (string) ga_setting( 'contact', 'hours_schema', 'Mo-Fr 10:00-13:00, Mo-Fr 14:00-19:00' ) ) ) ); + $data = array_filter( array( + '@context' => 'https://schema.org', + '@type' => 'AnimalShelter', + '@id' => home_url( '/#protectora' ), + 'name' => 'Bilagun · Gure Ametsa Bi Lagun', + 'alternateName'=> array( 'Bilagun', 'Gure Ametsa Bi Lagun' ), + 'url' => home_url( '/' ), + 'logo' => content_url( 'mu-plugins/gure-ametsa/assets/logo-mark.png' ), + 'image' => content_url( 'mu-plugins/gure-ametsa/assets/logo-mark.png' ), + 'description' => get_bloginfo( 'description' ), + 'telephone' => ga_info( 'telefono' ) ? '+34 ' . ga_info( 'telefono' ) : '', + 'email' => ga_info( 'email' ), + 'address' => ga_postal_address(), + 'openingHours' => $hours, + 'hasMap' => ga_info( 'maps' ), + 'areaServed' => array( 'Hondarribia', 'Irun' ), + 'sameAs' => array_values( array_filter( array( ga_info( 'instagram' ), ga_info( 'facebook' ), ga_info( 'tiktok' ), ga_info( 'youtube' ) ) ) ), + 'knowsLanguage'=> array( 'es', 'eu' ), + ) ); + echo '\n"; +}, 20 ); diff --git a/wp-content/themes/gure-ametsa/assets/js/main.js b/wp-content/themes/gure-ametsa/assets/js/main.js index 7b71f51..3a7c971 100644 --- a/wp-content/themes/gure-ametsa/assets/js/main.js +++ b/wp-content/themes/gure-ametsa/assets/js/main.js @@ -83,3 +83,12 @@ } ); } ); } )(); + +// Formulario: campo «día y hora» solo cuando el motivo es pedir cita. +( function () { + document.querySelectorAll( '.ga-form select[name="motivo"]' ).forEach( function ( select ) { + var field = select.form.querySelector( '.ga-form__visit' ); + if ( ! field ) { return; } + select.addEventListener( 'change', function () { field.hidden = select.value !== 'visita'; } ); + } ); +} )(); diff --git a/wp-content/themes/gure-ametsa/inc/registry.php b/wp-content/themes/gure-ametsa/inc/registry.php index 6f50185..f3d5ece 100644 --- a/wp-content/themes/gure-ametsa/inc/registry.php +++ b/wp-content/themes/gure-ametsa/inc/registry.php @@ -183,6 +183,7 @@ function ga_customizer_registry() { '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 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' ), + 'hours_schema' => array( 'type' => 'text', 'label' => 'Horario para Google (formato: Mo-Fr 10:00-13:00, Sa 10:00-14:00)', 'default' => 'Mo-Fr 10:00-13:00, Mo-Fr 14:00-19:00', 'description' => 'Días en inglés abreviado (Mo, Tu, We, Th, Fr, Sa, Su). Aparece en Google y Maps.' ), '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' ), ), ),