ID; if ( function_exists( 'pll_get_post' ) ) { $id = pll_get_post( $id, ga_lang() ) ?: $id; } return get_permalink( $id ) . $fragment; } /** URL del listado de una especie (slug en castellano: perro, gato) en el idioma actual. */ function ga_species_url( $slug_es ) { $term = get_term_by( 'slug', $slug_es, 'especie' ); if ( $term && function_exists( 'pll_get_term' ) ) { $translated = pll_get_term( $term->term_id, ga_lang() ); $term = $translated ? get_term( $translated, 'especie' ) : $term; } $url = $term && ! is_wp_error( $term ) ? get_term_link( $term ) : ''; return is_wp_error( $url ) || ! $url ? get_post_type_archive_link( 'animal' ) : $url; } /* Animales y especies son traducibles; los mensajes no. */ add_filter( 'pll_get_post_types', function ( $types ) { $types['animal'] = 'animal'; unset( $types['ga_mensaje'] ); return $types; } ); add_filter( 'pll_get_taxonomies', function ( $taxonomies ) { $taxonomies['especie'] = 'especie'; return $taxonomies; } ); /** * Ajuste del personalizador del tema, con valor por defecto si el tema no está activo. */ function ga_setting( $section, $field, $default = '' ) { if ( function_exists( 'ga_opt' ) ) { $value = ga_opt( $section, $field ); return null === $value ? $default : $value; } return $default; } /* ------------------------------------------------------------------------- * Datos de la protectora (el tema los sustituye por los del personalizador) * ---------------------------------------------------------------------- */ function ga_info( $key = null ) { $info = apply_filters( 'ga_info', array( 'nombre' => 'Bilagun', 'direccion' => 'Jaizubia, 44 · 20280 Hondarribia (Gipuzkoa)', 'telefono' => '943 64 52 79', 'email' => 'hola@gureametsabilagun.org', 'horario' => ga__( 'Lunes a viernes: 10:00–13:00 y 14:00–19:00', 'Astelehenetik ostiralera: 10:00–13:00 eta 14:00–19:00' ), 'cita' => ga__( 'Atendemos con cita previa. Escríbenos o llámanos antes de venir.', 'Aurretiko hitzorduarekin artatzen dugu. Idatzi edo deitu iezaguzu etorri aurretik.' ), 'instagram' => 'https://www.instagram.com/gureametsabilagun/', 'facebook' => 'https://www.facebook.com/gureametsabilagun/', 'maps' => 'https://www.google.com/maps/search/?api=1&query=Jaizubia+44+Hondarribia', ) ); return $key ? ( $info[ $key ] ?? '' ) : $info; } /** Correo que recibe los formularios: ajuste del panel → variable GA_CONTACT_EMAIL → administrador. */ function ga_contact_email() { $email = ga_setting( 'adopcion', 'form_email', '' ); if ( ! is_email( $email ) ) { $email = getenv( 'GA_CONTACT_EMAIL' ); } return is_email( $email ) ? $email : get_option( 'admin_email' ); }