add_action('wp_head', 'px_cursor_html', 9999); // Hook cursor JS into footer add_action('wp_footer', 'px_cursor_js', 9999); // Function to output cursor HTML function px_cursor_html() { // Prevent execution inside Divi Builder if (defined('ET_FB_ENABLED') && ET_FB_ENABLED) return; // Get cursor enable/disable option $enable = et_get_option('divi_PX_cursor_enable', 'off'); // Proceed only if enabled and not in admin panel if ($enable == 'on' && !is_admin()) { // Get available cursor styles $px_cursor_images = px_get_cursor_styles(); // Get selected cursor from options $selected = get_option('divi_cursor_images'); // Fallback to default cursor if not valid if (empty($selected) || !isset($px_cursor_images[$selected])) { $selected = 'px_cursor2'; } // Get cursor customization options $divi_PX_cursor_size = et_get_option('divi_PX_cursor_size', '40'); $divi_PX_cursor_border_color = et_get_option('divi_PX_cursor_border', '#000000'); $divi_PX_cursor_background_color = et_get_option('divi_PX_cursor_bg', 'transparent'); // Include selected cursor template file if exists if (isset($px_cursor_images[$selected])) { $file_path = get_stylesheet_directory() . '/extra-options/cursor/' . $selected . '.php'; if (file_exists($file_path)) { include $file_path; } } } } // Function to output cursor JavaScript function px_cursor_js() { // Prevent execution inside Divi Builder if (defined('ET_FB_ENABLED') && ET_FB_ENABLED) return; // Get cursor enable option (default ON here) $enable = et_get_option('divi_PX_cursor_enable', 'on'); // Proceed only if enabled and not in admin panel if ($enable == 'on' && !is_admin()) { ?>