Web de Gure Ametsa Bi Lagun en WordPress para Dokploy
- 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>
This commit is contained in:
88
wp-content/themes/gure-ametsa/template-parts/home/hero.php
Normal file
88
wp-content/themes/gure-ametsa/template-parts/home/hero.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
$image = (int) ga_opt( 'hero', 'image' );
|
||||
$video = (int) ga_opt( 'hero', 'video' );
|
||||
$full = 'full' === ga_opt( 'hero', 'layout' );
|
||||
$overlay = min( 95, (int) ga_opt( 'hero', 'overlay' ) ) / 100;
|
||||
$btn1 = ga_link( ga_opt( 'hero', 'btn1_url' ), get_post_type_archive_link( 'animal' ) );
|
||||
$btn2 = ga_link( ga_opt( 'hero', 'btn2_url' ), ga_page_url( 'contacto', '#formulario' ) );
|
||||
$doors = ga_opt( 'hero', 'doors' );
|
||||
|
||||
$colabora = ga_page_url( 'colabora' );
|
||||
$door_links = array(
|
||||
1 => get_post_type_archive_link( 'animal' ),
|
||||
2 => $colabora . '#acogida',
|
||||
3 => $colabora . '#voluntariado',
|
||||
4 => $colabora . '#donaciones',
|
||||
);
|
||||
|
||||
$classes = array( 'ga-hero', $full ? 'ga-hero--full' : 'ga-hero--split' );
|
||||
if ( $full && ( $image || $video ) ) {
|
||||
$classes[] = 'has-media';
|
||||
}
|
||||
if ( $doors ) {
|
||||
$classes[] = 'has-doors';
|
||||
}
|
||||
?>
|
||||
<section class="<?php echo esc_attr( implode( ' ', $classes ) ); ?>" style="--ga-overlay:<?php echo esc_attr( $overlay ); ?>">
|
||||
<?php if ( $full && ( $image || $video ) ) : ?>
|
||||
<div class="ga-hero__bg" aria-hidden="true">
|
||||
<?php if ( $video && wp_get_attachment_url( $video ) ) : ?>
|
||||
<video autoplay muted loop playsinline preload="metadata"
|
||||
<?php echo $image ? 'poster="' . esc_url( wp_get_attachment_image_url( $image, 'full' ) ) . '"' : ''; ?>>
|
||||
<source src="<?php echo esc_url( wp_get_attachment_url( $video ) ); ?>" type="<?php echo esc_attr( get_post_mime_type( $video ) ); ?>">
|
||||
</video>
|
||||
<?php else : ?>
|
||||
<?php echo wp_get_attachment_image( $image, 'full', false, array( 'fetchpriority' => 'high', 'alt' => '' ) ); ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php elseif ( $full ) : ?>
|
||||
<div class="ga-hero__paw" aria-hidden="true"><?php echo ga_icon( 'paw' ); ?></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="ga-wrap ga-hero__inner">
|
||||
<div class="ga-hero__text">
|
||||
<?php if ( ga_opt( 'hero', 'eyebrow' ) ) : ?>
|
||||
<span class="ga-pill"><?php ga_opt_e( 'hero', 'eyebrow' ); ?></span>
|
||||
<?php endif; ?>
|
||||
<h1><?php echo ga_highlight( ga_opt( 'hero', 'title' ) ); // Escapado en la función. ?></h1>
|
||||
<?php if ( ga_opt( 'hero', 'lead' ) ) : ?>
|
||||
<p class="ga-hero__lead"><?php ga_opt_e( 'hero', 'lead' ); ?></p>
|
||||
<?php endif; ?>
|
||||
<div class="ga-hero__actions">
|
||||
<?php if ( ga_opt( 'hero', 'btn1' ) ) : ?>
|
||||
<a class="ga-btn ga-btn--accent" href="<?php echo esc_url( $btn1 ); ?>"><?php ga_opt_e( 'hero', 'btn1' ); ?> <?php echo ga_icon( 'arrow' ); ?></a>
|
||||
<?php endif; ?>
|
||||
<?php if ( ga_opt( 'hero', 'btn2' ) ) : ?>
|
||||
<a class="ga-btn ga-btn--ghost" href="<?php echo esc_url( $btn2 ); ?>"><?php ga_opt_e( 'hero', 'btn2' ); ?></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ( ! $full ) : ?>
|
||||
<div class="ga-hero__media">
|
||||
<?php if ( $image ) : ?>
|
||||
<?php echo wp_get_attachment_image( $image, 'large', false, array( 'fetchpriority' => 'high' ) ); ?>
|
||||
<?php else : ?>
|
||||
<div class="ga-hero__art"><?php echo ga_icon( 'paw' ); ?></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<?php if ( $doors ) : ?>
|
||||
<nav class="ga-doors" aria-label="<?php echo esc_attr( ga__( 'Formas de ayudar', 'Laguntzeko moduak' ) ); ?>">
|
||||
<div class="ga-wrap ga-doors__grid">
|
||||
<?php foreach ( $door_links as $n => $href ) : ?>
|
||||
<?php if ( ga_opt( 'hero', "door{$n}_title" ) ) : ?>
|
||||
<a class="ga-door ga-door--<?php echo (int) $n; ?>" href="<?php echo esc_url( $href ); ?>">
|
||||
<span class="ga-door__kicker"><?php ga_opt_e( 'hero', "door{$n}_kicker" ); ?></span>
|
||||
<span class="ga-door__title"><?php ga_opt_e( 'hero', "door{$n}_title" ); ?></span>
|
||||
<span class="ga-door__text"><?php ga_opt_e( 'hero', "door{$n}_text" ); ?></span>
|
||||
<span class="ga-door__link"><?php ga_opt_e( 'hero', "door{$n}_link" ); ?> <?php echo ga_icon( 'arrow' ); ?></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
Reference in New Issue
Block a user