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:
2026-09-24 22:16:24 +02:00
parent 532bc620de
commit 4acc8b62d1
41 changed files with 1985 additions and 1533 deletions

View File

@@ -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>