Carrusel de animales más fácil de entender

- Botones grandes con texto («Anteriores» / «Siguientes»; en móvil solo flechas, con nombre accesible).
- Contador «1–3 / 10» y la siguiente tarjeta asomando por el borde para que se vea que hay más.
- Última tarjeta «Ver todos los animales» que lleva a la página Adopta.
- Arreglado: al empezar, «Anteriores» no salía desactivado (el scroll-snap desplazaba 4 px).
- Versión del tema 2.3.1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-27 16:09:30 +02:00
parent 01ad04bc14
commit f6150bd71b
4 changed files with 65 additions and 13 deletions

View File

@@ -506,11 +506,30 @@ function ga_carousel_open( $label = '' ) {
);
}
function ga_carousel_close() {
/**
* Cierre del carrusel: última tarjeta «Ver todos», botones con texto y contador («1–3 / 10»).
*
* @param string|false $more_url Enlace de la última tarjeta (por defecto, la página Adopta); false = sin ella.
*/
function ga_carousel_close( $more_url = null ) {
$more_url = null === $more_url ? get_post_type_archive_link( 'animal' ) : $more_url;
$arrow = function_exists( 'ga_icon' ) ? ga_icon( 'arrow' ) : '→';
if ( $more_url ) {
printf(
'<a class="ga-carousel__more" href="%s">%s<span>%s</span>%s</a>',
esc_url( $more_url ),
function_exists( 'ga_icon' ) ? ga_icon( 'paw' ) : '',
esc_html( ga__( 'Ver todos los animales', 'Animalia guztiak ikusi' ) ),
$arrow // SVG estático del tema.
);
}
printf(
'</div><div class="ga-carousel__nav"><button type="button" class="ga-carousel__btn" data-dir="-1" aria-label="%s">←</button><button type="button" class="ga-carousel__btn" data-dir="1" aria-label="%s">→</button></div></div>',
esc_attr( ga__( 'Anteriores', 'Aurrekoak' ) ),
esc_attr( ga__( 'Siguientes', 'Hurrengoak' ) )
'</div><div class="ga-carousel__nav"><button type="button" class="ga-carousel__btn" data-dir="-1">%1$s<span>%2$s</span></button>'
. '<span class="ga-carousel__count" aria-live="polite"></span>'
. '<button type="button" class="ga-carousel__btn" data-dir="1"><span>%3$s</span>%1$s</button></div></div>',
$arrow, // SVG estático del tema.
esc_html( ga__( 'Anteriores', 'Aurrekoak' ) ),
esc_html( ga__( 'Siguientes', 'Hurrengoak' ) )
);
}