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

@@ -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();