ID, '_ai_feed_url', true); ?> $columns['cb'], // checkbox para selección múltiple 'title' => __('Nombre de la fuente', 'ai-feeds'), 'url' => __('URL', 'ai-feeds'), ]; } add_filter('manage_ai_feed_posts_columns', 'aife_custom_columns'); // Rellenar contenido de columnas personalizadas function aife_custom_columns_content($column, $post_id) { switch ($column) { case 'url': $url = get_post_meta($post_id, '_ai_feed_url', true); echo esc_url($url); break; } } add_action('manage_ai_feed_posts_custom_column', 'aife_custom_columns_content', 10, 2); // Ocultar metaboxes innecesarias en ai_feed function aife_remove_extra_metaboxes() { global $wp_meta_boxes; // Aquí especificamos exactamente qué pantalla queremos limpiar $screen = 'ai_feed'; // Eliminamos metaboxes normales, avanzadas y laterales $contexts = ['normal', 'advanced', 'side']; foreach ($contexts as $context) { if (isset($wp_meta_boxes[$screen][$context])) { foreach ($wp_meta_boxes[$screen][$context] as $priority => $boxes) { foreach ($boxes as $id => $box) { // Solo mantenemos la caja de URL (la nuestra propia) if ($id !== 'AIFE_URL_metabox' && $id !== 'submitdiv') { remove_meta_box($id, $screen, $context); } } } } } } add_action('do_meta_boxes', 'aife_remove_extra_metaboxes', 999); function aife_add_custom_fields_metabox() { $settings = get_option( 'aife_settings', [] ); $campos = $settings['registrar_meta_keys'] ?? []; // Filtrar campos que NO estén definidos por ACF $campos_a_mostrar = []; foreach ( $campos as $key ) { if ( function_exists( 'get_field_object' ) ) { $acf = get_field_object( $key, 'post' ); if ( ! $acf ) { $campos_a_mostrar[] = $key; } } else { $campos_a_mostrar[] = $key; } } if ( empty( $campos_a_mostrar ) ) { return; // No hay campos que mostrar porque todos están en ACF } add_meta_box( 'aife_custom_fields', __( 'Campos AI Feeds', 'ai-feeds' ), function( $post ) use ( $campos_a_mostrar ) { aife_custom_fields_metabox_callback( $post, $campos_a_mostrar ); }, 'post', 'normal', 'default' ); } add_action( 'add_meta_boxes', 'aife_add_custom_fields_metabox' ); function aife_custom_fields_metabox_callback( $post, $campos ) { wp_nonce_field( 'aife_save_custom_fields', 'aife_custom_fields_nonce' ); foreach ( $campos as $key ) { $value = get_post_meta( $post->ID, $key, true ); ?>


$columns['cb'], 'title' => __( 'Nombre de la fuente', 'ai-feeds' ), 'url' => __( 'URL', 'ai-feeds' ), 'importar_noticias' => __( 'Importar noticias', 'ai-feeds' ), 'aife_ajustes' => __( 'Ajustes', 'ai-feeds' ), 'hereda_ajustes' => __( 'Hereda ajustes', 'ai-feeds' ), ]; } add_action( 'manage_ai_feed_posts_custom_column', 'aife_render_custom_columns', 10, 2 ); function aife_render_custom_columns( $column, $post_id ) { if ( $column === 'hereda_ajustes' ) { $hereda = get_post_meta( $post_id, '_aife_hereda_ajustes', true ) === '1'; echo '
'; echo ''; echo '
'; } if ( $column === 'importar_noticias' ) { $nonce = wp_create_nonce('importar_feed_' . $post_id); $url = admin_url('admin.php?page=aife_importar_noticias&feed_id=' . $post_id . '&_wpnonce=' . $nonce); echo ''; echo esc_html__('Importar ahora', 'ai-feeds'); echo ''; } if ( $column === 'aife_ajustes' ) { $url = wp_nonce_url( admin_url( 'admin.php?page=aife_feed_settings&feed_id=' . $post_id ), 'editar_ajustes_feed_' . $post_id ); echo '' . esc_html__( 'Ajustes del feed', 'ai-feeds' ) . ''; } }