post_type ) ) { wp_enqueue_style( 'ai-feeds-style', AIFE_URL . 'assets/css/ai-feeds.css', array(), AIFE_VERSION ); } // JS común (ajustar solo si es necesario) wp_enqueue_script( 'ai-feeds', AIFE_URL . 'assets/js/ai-feeds.js', array('jquery', 'wp-i18n'), // ← agregas wp-i18n aquí AIFE_VERSION, true ); wp_localize_script('ai-feeds', 'aiFeeds', [ 'restUrl' => rest_url(), 'nonce' => wp_create_nonce('wp_rest'), 'restEnabled' => aife_comprobar_api_rest_activa() ? true : false, 'siteUrl' => get_site_url(), 'adminUrl' => admin_url(), 'toggleHerenciaNonce' => wp_create_nonce('aife_toggle_herencia_nonce') ]); //COLA DE TRABAJO if ( $page === 'aife_cola_trabajo' ) { wp_enqueue_script( 'ai-feeds-cola-trabajo', AIFE_URL . 'assets/js/procesador-noticia.js', array('jquery'), AIFE_VERSION, true ); } //HISTORIAL Comprueba si estamos en edit.php y post_type=post if ( 'edit' === $screen->base && 'post' === $screen->post_type ) { wp_enqueue_style( 'ai-feeds-historial-style', AIFE_URL . 'assets/css/ai-feeds-historial.css', array(), AIFE_VERSION ); } //BIBLIOTECA if ( $page === 'aife_biblioteca' ) { $model = new aife_Model(); $mis_fuentes_urls = $model->get_mis_fuentes(); wp_enqueue_script( 'ai-feeds-biblioteca', AIFE_URL . 'assets/js/biblioteca.js', array('jquery'), AIFE_VERSION, true ); wp_localize_script('ai-feeds-biblioteca', 'aiFeeds', array( 'ajaxurl' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('aife_nonce'), 'importedFeeds' => $mis_fuentes_urls )); } //IMPORTADOR if ( $page === 'aife_importar_noticias' ) { wp_enqueue_script( 'ai-feeds-importas-noticias', AIFE_URL . 'assets/js/importador.js', array('jquery'), AIFE_VERSION, true ); } //AJUSTES $is_ajustes_page = in_array( $page, [ 'aife_ajustes', 'aife_feed_settings' ], true ); $is_ai_feed_list = $pagenow === 'edit.php' && $post_type === 'ai_feed'; if ( $is_ajustes_page || $is_ai_feed_list ) { wp_enqueue_style( 'ai-feeds-ajustes-style', AIFE_URL . 'assets/css/ajustes.css', array(), AIFE_VERSION, ); // SELECT2 wp_enqueue_style( 'ai-feeds-select2', AIFE_URL . 'assets/css/select2.min.css', [], AIFE_VERSION ); wp_enqueue_script( 'ai-feeds-select2-select2', AIFE_URL . 'assets/js/select2.min.js', ['jquery'], AIFE_VERSION, true ); } if ( $is_ajustes_page) { wp_enqueue_script( 'ai-feeds-ajustes-js', AIFE_URL . 'assets/js/ajustes.js', array(), AIFE_VERSION, true ); } } add_action('admin_enqueue_scripts', 'aife_enqueue_admin_scripts'); function aife_enqueue_admin_global_styles() { $css = " #adminmenu .toplevel_page_ai_feeds .wp-menu-image:before { color: #2271b1; } #adminmenu .toplevel_page_ai_feeds.wp-has-current-submenu .wp-menu-image:before { color: #ffffff; } "; wp_add_inline_style('wp-admin', $css); } add_action('admin_enqueue_scripts', 'aife_enqueue_admin_global_styles');