/** * GadgetGo - Popup avviso spedizioni (7/8 -> 25/8) - robusto */ function gadgetgo_is_holiday_window(): bool { $tz = wp_timezone(); $now = new DateTime('now', $tz); $start = new DateTime('2026-08-07 00:00:00', $tz); $end = new DateTime('2026-08-25 23:59:59', $tz); return ($now >= $start && $now <= $end); } function gadgetgo_should_show_popup(): bool { if ( is_admin() ) return false; if ( !gadgetgo_is_holiday_window() ) return false; // Solo carrello + checkout, ma non pagina "ordine ricevuto" if ( function_exists('is_order_received_page') && is_order_received_page() ) return false; return ( function_exists('is_cart') && is_cart() ) || ( function_exists('is_checkout') && is_checkout() ); } function gadgetgo_render_holiday_popup() { if ( !gadgetgo_should_show_popup() ) return; ?>