- 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>
108 lines
4.5 KiB
PHP
108 lines
4.5 KiB
PHP
<?php
|
|
get_header();
|
|
|
|
while ( have_posts() ) :
|
|
the_post();
|
|
$id = get_the_ID();
|
|
$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(
|
|
$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' ),
|
|
) );
|
|
$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 ga-section--tight">
|
|
<div class="ga-wrap">
|
|
<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__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><?php the_title(); ?></h1>
|
|
|
|
<?php if ( $facts ) : ?>
|
|
<ul class="ga-animal__facts">
|
|
<?php foreach ( $facts as $label => $value ) : ?>
|
|
<li><span><?php echo esc_html( $label ); ?></span><strong><?php echo esc_html( $value ); ?></strong></li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
<?php endif; ?>
|
|
|
|
<div class="ga-animal__story"><?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( '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 : ?>
|
|
<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
|
|
endwhile;
|
|
|
|
get_footer();
|