?php
/**
* Firemouth Aquaristic — Child Theme Functions
* Parent: Storefront
*/
defined( 'ABSPATH' ) || exit;
// ── Enqueue parent + child styles ─────────────────────────────────────────────
add_action( 'wp_enqueue_scripts', function () {
// Parent Storefront styles
wp_enqueue_style(
'storefront-parent',
get_template_directory_uri() . '/style.css',
[],
wp_get_theme( 'storefront' )-get( 'Version' )
);
// Child theme styles
wp_enqueue_style(
'firemouth-child',
get_stylesheet_directory_uri() . '/style.css',
[ 'storefront-parent' ],
wp_get_theme()->get( 'Version' )
);
}, 20 );
// ── Theme supports ────────────────────────────────────────────────────────────
add_action( 'after_setup_theme', function () {
add_theme_support( 'custom-logo', [
'height' => 80,
'width' => 200,
'flex-height' => true,
'flex-width' => true,
] );
add_theme_support( 'woocommerce' );
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
} );
// ── Remove Storefront's default homepage sections (optional) ──────────────────
// Uncomment if you want a clean homepage:
// remove_action( 'homepage', 'storefront_homepage_content', 10 );
// ── Products per page ─────────────────────────────────────────────────────────
add_filter( 'loop_shop_per_page', fn() => 24, 20 );
// ── Products per row ──────────────────────────────────────────────────────────
add_filter( 'loop_shop_columns', fn() => 3 );
// ── Disable PayPal (Firemouth uses Bizum + Stripe only) ──────────────────────
add_filter( 'woocommerce_available_payment_gateways', function ( $gateways ) {
unset( $gateways['paypal'] );
return $gateways;
} );
// ── Custom footer credit ──────────────────────────────────────────────────────
add_filter( 'storefront_credit_links_output', function () {
return '
Firemouth Aquaristic — Importaciones directas de peces tropicales
';
} );
// ── Add "Importaciones" to WooCommerce shop message ──────────────────────────
add_action( 'woocommerce_before_shop_loop', function () {
if ( ! is_product_taxonomy() ) return;
$term = get_queried_object();
if ( $term && $term->taxonomy === 'fi_llegada' ) {
// Find importacion linked to this term
$posts = get_posts( [
'post_type' => 'fi_importacion',
'title_filter' => $term->name,
'posts_per_page' => 1,
] );
if ( $posts ) {
$post_id = $posts[0]->ID;
$pais = get_post_meta( $post_id, '_fi_pais', true );
$fecha = get_post_meta( $post_id, '_fi_fecha_llegada', true );
echo '
';
echo '
🌍 ' . esc_html( $term->name ) . '
';
if ( $pais ) echo '
País de origen: ' . esc_html( $pais ) . '
';
if ( $fecha ) echo '
Llegada estimada: ' . date_i18n( 'd/m/Y', strtotime( $fecha ) ) . '
';
echo '
💡 Todos los peces de esta llegada tienen un –20% de descuento al reservar.
';
echo '
';
}
}
}, 5 );
// ── Rename WooCommerce "Shop" to "Tienda Online" ─────────────────────────────
add_filter( 'woocommerce_breadcrumb_defaults', function ( $defaults ) {
$defaults['home'] = 'Inicio';
return $defaults;
} );
// ── Add WhatsApp floating button (DESACTIVADO) ──────────────────────────────────────────────
// add_action( 'wp_footer', function () {
// ?>
?php
// } );
// ── Taxonomy banner CSS ────────────────────────────────────────────────────────
add_action( 'wp_head', function () {
echo '