- Docker Compose (WordPress + MariaDB) listo para Dokploy, con instalación automática por etapas: idiomas, páginas, menús y plugins recomendados. - Web bilingüe castellano / euskera con Polylang. - Tema propio «gure-ametsa»: diseño inspirado en Beargrass Animal Rescue, personalizable desde Apariencia → Personalizar (paletas, tipografías, secciones de portada ordenables) y patrones de bloques propios. - Plugin mu «gure-ametsa-core»: animales en adopción con ficha y filtros, carrusel y formulario de contacto/adopción. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
123 lines
5.0 KiB
PHP
123 lines
5.0 KiB
PHP
<?php
|
|
global $wp_query;
|
|
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'] ),
|
|
);
|
|
|
|
$title = $current
|
|
? ga__( ga_plural( $current->name ) . ' en adopción', ga_plural( $current->name ) . ' adopzioan' )
|
|
: ga__( 'Animales en adopción', 'Animaliak adopzioan' );
|
|
?>
|
|
|
|
<header class="ga-page-head">
|
|
<div class="ga-wrap">
|
|
<span class="ga-eyebrow"><?php ga_e( 'Puerta uno · Adopta', 'Lehen atea · 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>
|
|
</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 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() ) : ?>
|
|
<div class="ga-grid">
|
|
<?php
|
|
while ( have_posts() ) :
|
|
the_post();
|
|
get_template_part( 'template-parts/animal-card' );
|
|
endwhile;
|
|
?>
|
|
</div>
|
|
<nav class="ga-pagination" aria-label="<?php echo esc_attr( ga__( 'Paginación', 'Orrikatzea' ) ); ?>">
|
|
<?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>
|
|
<?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>
|
|
</div>
|
|
</section>
|
|
|
|
<?php
|
|
get_footer();
|