fix: sección pre-footer portada + scripts importación delta marzo-mayo 2026

- fea-homepage.php: nuevo shortcode [fea_prefooter] — 3 columnas (Ediciones |
  Noticias de alcance | Publicidad) sobre el footer. Imagen noticias_2025.jpg
  apunta a wp-content/uploads/recursos/ (fix ruta Joomla rota). Columna central
  y vídeo de la semana son dinámicos (último post de las categorías respectivas).
- scripts/import_new_k2_items.py: importa 169 K2 items nuevos (id > 17873)
- scripts/fix_imported_k2_metas.py: asigna metas/cats/Polylang a esos 169 posts
- scripts/import_new_cartas.py: importa 8 cartas nuevas (ew4r_content id > 9043,
  catid 27/40/41) y asigna _carta_id a los artículos K2 por fecha
- scripts/import_new_content.py: importa 58 ítems ew4r_content no-carta
  (multimedia, noticias, tablón, etc.) con mapping catid→WP term

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-03 22:27:33 -04:00
parent 18522a01ee
commit c6f16ba739
5 changed files with 1240 additions and 0 deletions
@@ -749,6 +749,80 @@ add_shortcode('fea_multimedia', function($atts) {
return $html . '</div></section>';
});
// ── Shortcode: [fea_prefooter] — 3 columnas sobre el footer ──────────────────
add_shortcode('fea_prefooter', function() {
$uploads = wp_upload_dir()['baseurl'];
// Columna centro: última noticia de alcance (cat term_id=41)
$latest_noticias = get_posts([
'posts_per_page' => 1,
'category__in' => [fea_cat(41)],
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC',
]);
$cat_noticias_url = get_category_link(fea_cat(41));
$noticia_title = !empty($latest_noticias) ? fea_title($latest_noticias[0]->post_title) : '';
$noticia_url = !empty($latest_noticias) ? get_permalink($latest_noticias[0]->ID) : $cat_noticias_url;
// Columna derecha: último vídeo (cat term_id=58)
$latest_video = get_posts([
'posts_per_page' => 1,
'category__in' => [fea_cat(58)],
'post_status' => 'publish',
'orderby' => 'date',
'order' => 'DESC',
]);
$video_url = !empty($latest_video) ? get_permalink($latest_video[0]->ID) : get_category_link(fea_cat(58));
$effa_url = get_permalink(42726);
$suma_url = get_permalink(18036);
$libros_url = get_category_link(1616);
$videos_escuela_url = get_permalink(21921);
ob_start(); ?>
<div class="fea-prefooter">
<div class="fea-prefooter-col">
<a href="<?php echo esc_url($libros_url); ?>">
<img src="<?php echo esc_url($uploads . '/banners/como_adquirir_nuestros_libros.gif'); ?>" alt="Cómo adquirir nuestros libros" style="display:block;margin:0 auto 8px;" />
</a>
<a href="<?php echo esc_url($videos_escuela_url); ?>">
<img src="<?php echo esc_url($uploads . '/quienes_somos/ultimos_videos.jpg'); ?>" alt="Últimos vídeos de la escuela" width="282" height="97" style="display:block;margin:0 auto;" />
</a>
</div>
<div class="fea-prefooter-col fea-prefooter-center">
<a href="<?php echo esc_url($cat_noticias_url); ?>">
<img src="<?php echo esc_url($uploads . '/recursos/noticias_2025.jpg'); ?>" alt="Noticias de alcance" width="300" height="340" style="display:block;margin:0 auto;" />
</a>
<?php if ($noticia_title): ?>
<p class="fea-prefooter-noticia">
<a href="<?php echo esc_url($noticia_url); ?>"><?php echo esc_html($noticia_title); ?></a>
</p>
<?php endif; ?>
</div>
<div class="fea-prefooter-col">
<a href="<?php echo esc_url($suma_url); ?>">
<img src="<?php echo esc_url($uploads . '/banners/este_portal.gif'); ?>" alt="Este portal" style="display:block;margin:0 auto 5px;" />
</a>
<a href="<?php echo esc_url($effa_url); ?>">
<img src="<?php echo esc_url($uploads . '/banners/acceso_a_EFFA.jpg'); ?>" alt="Acceso a EFFA" style="display:block;margin:0 auto 5px;" />
</a>
<a href="<?php echo esc_url($video_url); ?>">
<img src="<?php echo esc_url($uploads . '/banners/video_de_la_semana1.jpg'); ?>" alt="Vídeo de la semana" style="display:block;margin:0 auto;" />
</a>
</div>
</div>
<?php
$css = '<style>
.fea-prefooter{display:flex;gap:1.5rem;justify-content:center;align-items:flex-start;padding:2rem 1rem;border-top:2px solid #e5e5e5;margin-top:3rem;}
.fea-prefooter-col{flex:1;max-width:320px;text-align:center;}
.fea-prefooter-noticia{margin-top:0.6rem;font-size:0.85rem;font-weight:600;color:#0000cc;line-height:1.3;}
.fea-prefooter-noticia a{color:#0000cc;}
@media(max-width:640px){.fea-prefooter{flex-direction:column;align-items:center;}.fea-prefooter-col{max-width:100%;}}
</style>';
return $css . ob_get_clean();
});
// ── Reescribir links internos al idioma activo (Polylang) ─────────────────
add_filter('the_content', function($content) {
if (!function_exists('pll_current_language') || !function_exists('pll_get_post')) return $content;