// 4. LIMPIEZA DE METADATOS DEL TEMA (ELIMINA FECHAS Y AUTORES) function cliera_remove_meta() { remove_action('colormag_entry_meta', 'colormag_entry_meta', 10); } add_action('init', 'cliera_remove_meta'); // 5. SOPORTE PARA CLASES PERSONALIZADAS EN GUTENBERG (LETRA CAPITAL) function cliera_editor_styles() { add_theme_support('editor-styles'); } add_action('after_setup_theme', 'cliera_editor_styles'); /* ============================================================ MOTOR VISUAL CLIERA 2026: RELACIONADOS INTELIGENTES FINAL ============================================================ */ // 1. INYECTOR INTELIGENTE (Prioridad Tags + Icono Video + Título Fijo) function cliera_inyector_relacionados_visual($content) { if ( !is_single() || is_attachment() ) return $content; $post_id = get_the_id(); $tags = wp_get_post_tags($post_id); $tag_ids = array(); if ($tags) { foreach($tags as $individual_tag) $tag_ids[] = $individual_tag->term_id; } // A. Búsqueda por TAGS $args = array( 'post__not_in' => array($post_id), 'posts_per_page' => 3, 'ignore_sticky_posts' => 1, 'tag__in' => $tag_ids, 'orderby' => 'rand' ); $query = new WP_Query($args); // B. Relleno por CATEGORÍA si no hay suficientes if ($query->post_count < 3) { $needed = 3 - $query->post_count; $exclude = array($post_id); foreach($query->posts as $p) $exclude[] = $p->ID; $categories = get_the_category($post_id); $filler_args = array( 'post__not_in' => $exclude, 'posts_per_page' => $needed, 'cat' => ($categories) ? $categories[0]->term_id : '', 'orderby' => 'rand' ); $filler_posts = get_posts($filler_args); $combined_posts = array_merge($query->posts, $filler_posts); } else { $combined_posts = $query->posts; } if ( !empty($combined_posts) ) { $output = ''; wp_reset_postdata(); return $content . $output; } return $content; } add_filter('the_content', 'cliera_inyector_relacionados_visual', 99); // 2. SHORTCODE: [cliera_frase_1x1] function cliera_shortcode_frase_1x1() { $query = new WP_Query(array('category_name' => 'frases', 'posts_per_page' => 1, 'orderby' => 'rand')); if ( $query->have_posts() ) { $query->the_post(); $img = get_the_post_thumbnail_url(get_the_ID(), 'medium') ?: 'https://2026.cliera.com/wp-content/uploads/2026/01/Logo-web.png'; $out = '
💡
Píldora de inspiración
'; wp_reset_postdata(); return $out; } } add_shortcode('cliera_frase_1x1', 'cliera_shortcode_frase_1x1'); // 3. SHORTCODE: [cliera_top_leidos] (Híbrido con videos-era) function cliera_shortcode_top_leidos() { $query = new WP_Query(array( 'posts_per_page' => 5, 'orderby' => 'comment_count', 'post_type' => 'post', 'category_name' => 'notas,videos-era' )); if ( $query->have_posts() ) { $out = '
LO + VISTO
'; $count = 1; while ( $query->have_posts() ) { $query->the_post(); $prefix = (has_category('videos-era')) ? ' ' : ''; $out .= ''.$count.'
'.$prefix.get_the_title().'
'; $count++; } $out .= '
'; wp_reset_postdata(); return $out; } } add_shortcode('cliera_top_leidos', 'cliera_shortcode_top_leidos'); // 4. SHORTCODE: [cliera_home_grid] function cliera_shortcode_home_grid() { $query = new WP_Query(array( 'posts_per_page' => 5, 'orderby' => 'comment_count', 'post_type' => 'post', 'category_name' => 'notas,videos-era' // Ahora sí buscará ambos )); if ( $query->have_posts() ) { $out = '
'; $count = 1; while ( $query->have_posts() ) { $query->the_post(); $thumb = get_the_post_thumbnail_url(get_the_ID(), 'large') ?: 'https://2026.cliera.com/wp-content/uploads/2026/01/Logo-web.png'; $cat = get_the_category(); $cat_name = $cat ? $cat[0]->name : 'Nota'; $prefix = (has_category('videos-era')) ? '▶ ' : ''; $grid_class = ($count === 1) ? 'mosaic-main' : 'mosaic-small'; $out .= '
'.$cat_name.'

'.$prefix.get_the_title().'

'; $count++; } $out .= '
'; wp_reset_postdata(); return $out; } } add_shortcode('cliera_home_grid', 'cliera_shortcode_home_grid'); // 5. CSS UNIFICADO Y BLINDADO add_action('wp_head', function() { echo ' '; }); /* ============================================================ OCULTAR IMAGEN DESTACADA EN CATEGORÍAS ESPECÍFICAS ============================================================ */ function cliera_ocultar_destacada_por_categoria($has_thumbnail, $post, $thumbnail_id) { // 1. Definimos los slugs de las categorías donde NO queremos imagen $categorias_sin_imagen = array( 'frases', 'videos-era', 'videos-de-antienvejecimiento', 'videos-de-estetica', 'videos-de-regenerativa' // Corregido: comilla simple y sin error de cierre ); // 2. Si es un post individual y tiene alguna de esas categorías, devolvemos 'false' if ( is_single() && has_category( $categorias_sin_imagen, $post ) ) { return false; } return $has_thumbnail; } add_filter('has_post_thumbnail', 'cliera_ocultar_destacada_por_categoria', 10, 3); /* ========================================================================== CLIERA BREADCRUMB UNIVERSAL - v13.5 Mejora: Enlaces activos en categorías y niveles intermedios. ========================================================================== */ add_action('wp_body_open', 'cliera_bc_v13_5', 5); function cliera_bc_v13_5() { if ( is_front_page() || is_home() ) return; $obj = get_queried_object(); $name = ""; $category_part = ""; // 1. ENTRADAS (Artículos con link a su categoría) if ( is_single() ) { $name = get_the_title(); $categories = get_the_category(); if ( !empty($categories) ) { $cat_link = get_category_link($categories[0]->term_id); $category_part = '' . esc_html($categories[0]->name) . ' / '; } } // 2. TAGS CLIERA (Con link a la página base de cada tipo) elseif ( is_tag() || is_tax() ) { $name = $obj->name; $desc = $obj->description; $cat_name = ""; $cat_slug = ""; if (strpos($desc, '[INVESTIGADOR:') !== false) { $cat_name = "INVESTIGADORES"; $cat_slug = "investigadores"; } elseif (strpos($desc, '[INSTITUCION:') !== false) { $cat_name = "INSTITUCIONES"; $cat_slug = "instituciones"; } elseif (strpos($desc, '[MEDICAMENTO:') !== false) { $cat_name = "MEDICAMENTOS"; $cat_slug = "vademecum"; } elseif (strpos($desc, '[CONCEPTO:') !== false) { $cat_name = "CONCEPTOS"; $cat_slug = "conceptos"; } if ($cat_name) { // Creamos el link dinámico a la página base (ej: cliera.com/investigadores) $cat_url = home_url('/' . $cat_slug . '/'); $category_part = '' . $cat_name . ' / '; } } elseif ( is_page() ) { $name = get_the_title(); } else { $name = isset($obj->name) ? $obj->name : ""; } if (!$name) return; echo '
INICIO / ' . $category_part . ' ' . esc_html($name) . '
'; } /* ========================================================================== CLIERA FICHA TÉCNICA MAESTRA - v14.0 (LA FOTO ES EL LINK) Identificador: [TAG-FICHA-V14.0] Cambios: 1. Se elimina el botón de texto. 2. La imagen principal ahora es el enlace al sitio web (si existe el tag [WEB:]). 3. Mantiene diseño fluido al 100% y animación de zoom. ========================================================================== */ add_action('wp_body_open', 'cliera_ficha_v14_0', 10); function cliera_ficha_v14_0() { if ( !is_tag() && !is_tax() ) return; $obj = get_queried_object(); $desc = $obj->description; if (strpos($desc, '[INVESTIGADOR:') === false && strpos($desc, '[INSTITUCION:') === false && strpos($desc, '[CONCEPTO:') === false && strpos($desc, '[MEDICAMENTO:') === false) return; // Extracción de Datos preg_match('/\[(?:UBICACION|DEFINICION|INDICACION|CARGO):(.*?)\]/', $desc, $m_u); preg_match('/\[(?:ESPECIALIDAD|CATEGORIA|CONTRIBUCION):(.*?)\]/', $desc, $m_e); preg_match('/\[(?:HITO|MECANISMO):(.*?)\]/', $desc, $m_h); preg_match('/\[BIO:(.*?)\]/', $desc, $m_b); preg_match('/\[INFO:(.*?)\]/', $desc, $m_i); preg_match('/\[VISION:(.*?)\]/', $desc, $m_v); // Captura del Link para la Foto $url_web = ""; if (preg_match('/\[WEB:(.*?)\]/', $desc, $matches)) { $url_web = trim($matches[1]); } $label_top = "Ficha Institucional"; $icon_main = "🏛️"; if(strpos($desc, '[INVESTIGADOR:') !== false) { $label_top = "Perfil Investigador"; $icon_main = "🔬"; } elseif(strpos($desc, '[CONCEPTO:') !== false) { $label_top = "Concepto Científico"; $icon_main = "🧬"; } elseif(strpos($desc, '[MEDICAMENTO:') !== false) { $label_top = "Vademécum CLIERA"; $icon_main = "💊"; } echo '
'.$icon_main.'
'.$label_top.'

'.esc_html($obj->name).'

'.((strpos($desc, "[INVESTIGADOR:") !== false && !empty($m_u[1])) ? "
".trim($m_u[1])."
" : "").' '.((!empty($m_b[1])) ? "
".trim($m_b[1])."
" : "").' '.((!empty($m_i[1])) ? "
".trim($m_i[1])."
" : "").'
'.((strpos($desc, "[INVESTIGADOR:") === false && !empty($m_u[1])) ? "
📍 Ubicación/Definición: ".trim($m_u[1])."
" : "" ).' '.((!empty($m_e[1])) ? "
🔬 Especialidad: ".trim($m_e[1])."
" : "").' '.((!empty($m_h[1])) ? "
🏆 Hito: ".trim($m_h[1])."
" : "").'
🛡️ Visión CLIERA: '.((!empty($m_v[1])) ? trim($m_v[1]) : "Rigor científico.").'
' . ($url_web ? '' : '') . ' ' . ($url_web ? '' : '') . '
📚 HEMEROTECA: Investigaciones y artículos vinculados disponibles abajo.
'; } /* ============================================================ SISTEMA DE AUDITORÍA DE VÍDEOS (VIGILANCIA SEMANAL) ============================================================ */ if ( ! wp_next_scheduled( 'cliera_revisar_videos_semanal' ) ) { wp_schedule_event( time(), 'weekly', 'cliera_revisar_videos_semanal' ); } add_action( 'cliera_revisar_videos_semanal', 'cliera_ejecutar_auditoria_videos' ); function cliera_ejecutar_auditoria_videos() { $query = new WP_Query(array('category_name' => 'videos', 'posts_per_page' => -1, 'post_type' => 'post')); $videos_rotos = array(); if ( $query->have_posts() ) { while ( $query->have_posts() ) { $query->the_post(); preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/\s]{11})%i', get_the_content(), $match); if ( isset($match[1]) ) { $response = wp_remote_head( "https://img.youtube.com/vi/".$match[1]."/mqdefault.jpg" ); if ( wp_remote_retrieve_response_code( $response ) == 404 ) { $videos_rotos[] = '- ' . get_the_title() . ' URL: ' . get_permalink(); } } } wp_reset_postdata(); } if ( ! empty( $videos_rotos ) ) { wp_mail( get_option( 'admin_email' ), '⚠️ CLIERA: Reporte Semanal Vídeos Rotos', "Se detectaron vídeos caídos:\n\n" . implode( "\n", $videos_rotos ) ); } } function cliera_indice_investigadores() { // Intentar obtener la lista del "cajoncito" (caché) $investigadores = get_transient('cliera_lista_investigadores'); if ( false === $investigadores ) { // Si no está en caché, hacemos el barrido $tags = get_terms(array('taxonomy' => 'post_tag', 'hide_empty' => false)); $investigadores = []; foreach ($tags as $tag) { if (strpos($tag->description, '[INVESTIGADOR:') !== false) { preg_match('/\[(?:CARGO|ESPECIALIDAD):(.*?)\]/', $tag->description, $match); $investigadores[] = [ 'name' => $tag->name, 'link' => get_term_link($tag), 'slug' => $tag->slug, 'desc' => !empty($match[1]) ? trim($match[1]) : 'Investigador CLIERA' ]; } } // Guardamos el resultado por 12 horas para no repetir el trabajo set_transient('cliera_lista_investigadores', $investigadores, 12 * HOUR_IN_SECONDS); } // El resto del código de renderizado (HTML) sigue igual... ob_start(); // ... (aquí va el HTML que te pasé arriba) ... return ob_get_clean(); } /* ============================================================ 📦 MÓDULO DE DIRECTORIOS MAESTRO CLIERA (v1.3 - BLINDADO) ============================================================ */ function cliera_generar_directorio_maestro($atts) { $a = shortcode_atts(array('tipo' => 'INVESTIGADOR'), $atts); $tipo_key = strtoupper($a['tipo']); $config = [ 'INVESTIGADOR' => ['label' => 'Investigadores', 'icon' => '🔬'], 'INSTITUCION' => ['label' => 'Instituciones', 'icon' => '🏛️'], 'MEDICAMENTO' => ['label' => 'Vademécum', 'icon' => '💊'], 'CONCEPTO' => ['label' => 'Glosario', 'icon' => '🧬'] ]; $data_c = $config[$tipo_key]; $cache_key = 'cliera_cache_v2_' . strtolower($tipo_key); $grupos = get_transient($cache_key); if (false === $grupos) { $tags = get_terms(array('taxonomy' => 'post_tag', 'hide_empty' => false)); $grupos = []; foreach ($tags as $tag) { if (strpos($tag->description, '[' . $tipo_key . ':') !== false) { preg_match('/\[SUB_RUBRO:(.*?)\]/', $tag->description, $m_sub); $categoria = !empty($m_sub[1]) ? trim($m_sub[1]) : 'General'; preg_match('/\[(?:CARGO|UBICACION|INDICACION|DEFINICION):(.*?)\]/', $tag->description, $m_info); $grupos[$categoria][] = [ 'name' => $tag->name, 'link' => get_term_link($tag), 'slug' => $tag->slug, 'txt' => !empty($m_info[1]) ? trim($m_info[1]) : 'Registro Oficial CLIERA' ]; } } ksort($grupos); set_transient($cache_key, $grupos, 12 * HOUR_IN_SECONDS); } // Iniciamos la construcción del HTML en una variable $output = '
'; $output .= ''; foreach ($grupos as $titulo_seccion => $items) { $output .= '
'; $output .= '

' . $data_c['icon'] . ' ' . $titulo_seccion . '

'; $output .= '
'; foreach ($items as $item) { $foto = "https://2026.cliera.com/wp-content/uploads/tag-assets/{$item['slug']}.png"; $fallback = "https://2026.cliera.com/wp-content/uploads/2026/01/Logo-web.png"; $output .= ''; $output .= '
'; $output .= '
'; $output .= '
'; $output .= '
' . $item['name'] . '
'; $output .= '
' . $item['txt'] . '
'; $output .= '
'; } $output .= '
'; } $output .= '
'; $output .= '

¿Desea proponer una actualización?

'; $output .= '

Si posee información científica relevante para ' . $data_c['label'] . ', le invitamos a colaborar.

'; $output .= 'Sugerir Cambio'; $output .= '
'; $output .= ''; return $output; } add_shortcode('cliera_directorio', 'cliera_generar_directorio_maestro'); /** * CLIERA: Disclaimer Editorial, Propiedad Intelectual y Enlaces Legales Globales */ function cliera_footer_disclaimer_block() { // Definimos las URLs (Asegúrate de que los slugs sean correctos) $privacy_url = 'https://2026.cliera.com/privacidad-y-cookies/'; $legal_url = 'https://2026.cliera.com/aviso-legal/'; echo '
'; } add_action('wp_footer', 'cliera_footer_disclaimer_block', 5); /* ============================================================ ANDREA V114: RESCATE DE LÍNEA INFINITA + TRANSPARENCIA 60% ============================================================ */ function cliera_master_v114_editorial() { $queried_obj = get_queried_object(); $uri = $_SERVER['REQUEST_URI']; if ( is_tag() || is_tax() ) return; $es_evento = ( (function_exists('tribe_is_event') && tribe_is_event()) || strpos($uri, '/eventos/') !== false ); $es_archivo_cat = is_category(); $es_single = is_singular('post'); if ( !$es_single && !$es_archivo_cat && !$es_evento ) return; $url_base = 'https://2026.cliera.com/wp-content/uploads/andrea-assets/'; $titulo = 'Editorial'; $avatar_url = ''; $descripcion_html = ''; if ( $es_evento ) { $avatar_url = $url_base . 'andrea-eventos.png'; $titulo = 'Próximos Eventos'; $descripcion_html = 'Agenda académica y encuentros científicos de la comunidad ERA.'; } else { $cat = (is_category()) ? $queried_obj : ((is_single()) ? get_the_category()[0] ?? null : null); $slug = ($cat) ? $cat->slug : ''; $titulo = (is_category()) ? $cat->name : get_the_title(); $avatar_url = (strpos($slug, 'video') !== false) ? $url_base . "andrea-video-random-" . rand(1, 7) . ".png" : $url_base . "andrea-random-" . rand(1, 7) . ".png"; if (is_category()) $descripcion_html = category_description(); } $img_parallax = ($es_single && !$es_evento) ? get_the_post_thumbnail_url(get_the_ID(), 'full') : ""; ?> echo ''; } add_action('wp_body_open', 'cliera_master_v114_editorial'); /* ============================================================ 🔍 BUSCADOR DUAL CLIERA: Separa Píldoras de Tags y Artículos de Post ============================================================ */ function cliera_busqueda_dual_avanzada() { if (is_search() && !is_admin()) { $search_query = get_search_query(); // 0. ECO DE BÚSQUEDA echo '
'; echo 'Explorando la base de datos para:'; echo '

' . esc_html($search_query) . '

'; echo '
'; $tags = get_terms(array('taxonomy' => 'post_tag', 'name__like' => $search_query, 'hide_empty' => false)); if (!empty($tags)) { echo '
'; // --- BARRA 1: PÍLDORAS CON ICONO FLOTANTE --- echo '
'; // El Icono Flotante echo '
💊
'; // La Barra echo '
'; echo '

Píldoras Encontradas

'; echo '
'; echo '
'; echo '
'; foreach ($tags as $tag) { if (strpos($tag->description, '[') !== false) { $link = get_term_link($tag); $foto = "https://2026.cliera.com/wp-content/uploads/tag-assets/{$tag->slug}.png"; $fallback = "https://2026.cliera.com/wp-content/uploads/2026/01/Logo-web.png"; $tipo = 'REGISTRO'; if (strpos($tag->description, '[INVESTIGADOR:') !== false) $tipo = 'INVESTIGADOR'; if (strpos($tag->description, '[INSTITUCION:') !== false) $tipo = 'INSTITUCION'; if (strpos($tag->description, '[MEDICAMENTO:') !== false) $tipo = 'VADEMÉCUM'; if (strpos($tag->description, '[CONCEPTO:') !== false) $tipo = 'GLOSARIO'; echo '
'.$tag->name.'
'.$tipo.' OFICIAL
'; } } echo '
'; // --- BARRA 2: ARTÍCULOS CON ICONO FLOTANTE --- echo '
'; // El Icono Flotante echo '
📰
'; // La Barra echo '
'; echo '

Artículos Relacionados

'; echo '
'; echo '
'; } } } add_action('loop_start', 'cliera_busqueda_dual_avanzada'); Contactos

Contactos

Si te gusta... Comparte