Initial commit — migración Joomla→WordPress feadulta.org
Incluye: mu-plugins custom (fea-homepage, carta-semana), scripts de migración/traducción/deploy, documentación de auditoría, análisis de cartas y HTML de evangelios exportados desde Joomla. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* Migrar IDIOMA a tags
|
||||
*/
|
||||
require_once('/var/www/html/wp-load.php');
|
||||
|
||||
echo "=== Migrando IDIOMA a tags ===\n\n";
|
||||
|
||||
// Mapeo de IDs de Joomla a nombres
|
||||
$idiomas_map = array(
|
||||
1 => 'English',
|
||||
2 => 'Galego',
|
||||
3 => 'Español',
|
||||
4 => 'Português',
|
||||
5 => 'Català'
|
||||
);
|
||||
|
||||
$created = 0;
|
||||
$assigned = 0;
|
||||
|
||||
foreach ($idiomas_map as $id => $nombre) {
|
||||
// Crear o encontrar tag
|
||||
$term = get_term_by('name', $nombre, 'post_tag');
|
||||
if (!$term) {
|
||||
$result = wp_insert_term($nombre, 'post_tag', array(
|
||||
'slug' => sanitize_title($nombre)
|
||||
));
|
||||
if (is_wp_error($result)) continue;
|
||||
$term_id = $result['term_id'];
|
||||
$created++;
|
||||
} else {
|
||||
$term_id = $term->term_id;
|
||||
}
|
||||
|
||||
// Buscar posts
|
||||
$posts = $wpdb->get_col($wpdb->prepare("
|
||||
SELECT DISTINCT pm.post_id
|
||||
FROM wp_postmeta pm
|
||||
JOIN wp_posts p ON pm.post_id = p.ID
|
||||
WHERE pm.meta_key = 'Idioma' AND pm.meta_value = %s
|
||||
AND p.post_type = 'post' AND p.post_status = 'publish'
|
||||
", $id));
|
||||
|
||||
foreach ($posts as $post_id) {
|
||||
wp_set_object_terms($post_id, $term_id, 'post_tag', true);
|
||||
$assigned++;
|
||||
}
|
||||
|
||||
echo "$nombre: " . count($posts) . " posts\n";
|
||||
}
|
||||
|
||||
echo "\nTags creados: $created\n";
|
||||
echo "Asignaciones: $assigned\n";
|
||||
echo "=== FIN ===\n";
|
||||
Reference in New Issue
Block a user