' . esc_html($agent_welcome_message) . '
Alex: WordPress Expert
'; // If "Disable Chat on Mobile" is enabled, inject JavaScript to hide it on small screens if ($disable_chat_mobile === '1') { echo ''; } } add_action('wp_footer', 'ai_agent_add_chat_widget'); add_action('admin_footer', function () { $current_screen = get_current_screen(); // phpcs:ignore WordPress.Security.NonceVerification.Recommended $page_param = isset($_GET['page']) ? sanitize_key(wp_unslash($_GET['page'])) : ''; if ($page_param === 'ai-agent' && isset($current_screen->id) && $current_screen->id === 'settings_page_ai-agent') { ai_agent_add_chat_widget(); } }); ?>