SEO local, perdidos/encontrados y solicitud de cita
- Datos estructurados schema.org AnimalShelter en la portada (dirección, horario para Google configurable, teléfono, redes, idiomas). - Preguntas frecuentes: animales perdidos o encontrados, con el buscador oficial de Euskadi. - Formulario: motivo «Pedir cita para una visita» con día y hora preferidos. - Migración 6: actualiza las preguntas frecuentes si no se han editado. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -34,6 +34,12 @@
|
||||
<!-- /wp:paragraph --></details>
|
||||
<!-- /wp:details -->
|
||||
|
||||
<!-- wp:details -->
|
||||
<details class="wp-block-details"><summary>He perdido o he encontrado un animal, ¿qué hago?</summary><!-- wp:paragraph -->
|
||||
<p>Avisa a la Policía Municipal de tu localidad y consulta el <a href="https://www.euskadi.eus/gobierno-vasco/-/encuentra-a-tu-mascota-perdida/">buscador de mascotas perdidas del Gobierno Vasco</a>. Si es en Irun u Hondarribia, escríbenos o llámanos también.</p>
|
||||
<!-- /wp:paragraph --></details>
|
||||
<!-- /wp:details -->
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>¿No encuentras tu respuesta? <a href="/contacto/#formulario">Escríbenos</a>.</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
@@ -34,6 +34,12 @@
|
||||
<!-- /wp:paragraph --></details>
|
||||
<!-- /wp:details -->
|
||||
|
||||
<!-- wp:details -->
|
||||
<details class="wp-block-details"><summary>Animalia bat galdu edo aurkitu dut, zer egin?</summary><!-- wp:paragraph -->
|
||||
<p>Jakinarazi zure herriko Udaltzaingoari eta kontsultatu <a href="https://www.euskadi.eus/gobierno-vasco/-/encuentra-a-tu-mascota-perdida/">Eusko Jaurlaritzaren maskota galduen bilatzailea</a>. Irunen edo Hondarribian bada, idatzi edo deitu iezaguzu ere.</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 -->
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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 ) {
|
||||
</label>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if ( ! $is_animal ) : ?>
|
||||
<label class="ga-form__visit"<?php echo 'visita' === $preselect ? '' : ' hidden'; ?>><?php ga_e( '¿Qué día y hora te vendría bien?', 'Zein egun eta ordu komeni zaizu?' ); ?>
|
||||
<input type="text" name="preferencia" placeholder="<?php echo esc_attr( ga__( 'Por ejemplo: martes o jueves por la tarde', 'Adibidez: asteartea edo osteguna arratsaldez' ) ); ?>">
|
||||
</label>
|
||||
<?php endif; ?>
|
||||
<?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; ?>
|
||||
@@ -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)'
|
||||
);
|
||||
|
||||
50
wp-content/mu-plugins/gure-ametsa/seo.php
Normal file
50
wp-content/mu-plugins/gure-ametsa/seo.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* SEO local: datos estructurados schema.org de la protectora (AnimalShelter) en la portada.
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
/** Dirección estructurada a partir de «Calle, nº · CP Localidad (Provincia)». */
|
||||
function ga_postal_address() {
|
||||
$raw = (string) ga_info( 'direccion' );
|
||||
$address = array( '@type' => '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 '<script type="application/ld+json">' . wp_json_encode( $data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE ) . "</script>\n";
|
||||
}, 20 );
|
||||
@@ -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'; } );
|
||||
} );
|
||||
} )();
|
||||
|
||||
@@ -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' ),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user