occasion = $occasion; $this->btn_link = $btn_link; $this->start_date = strtotime($start_date); $this->end_date = strtotime($end_date); if ('yes' === get_option('_is_show_eid_ul_fitr_26_banner', 'yes')) { // Hook into the admin_notices action to display the banner add_action('admin_notices', [$this, 'display_banner']); add_action('admin_head', array($this, 'add_styles')); } } /** * Calculate time remaining until Halloween * * @return array Time remaining in days, hours, and minutes */ public function wpf_get_promotion_banner_countdown() { $end_date = strtotime('2026-01-07 23:59:59'); $now = current_time('timestamp'); $diff = $end_date - $now; return array( 'days' => floor($diff / (60 * 60 * 24)), 'hours' => floor(($diff % (60 * 60 * 24)) / (60 * 60)), 'mins' => floor(($diff % (60 * 60)) / 60), 'secs' => $diff % 60, ); } /** * Displays the special occasion banner if the current date and time are within the specified range. */ public function display_banner() { $screen = get_current_screen(); $promotional_notice_pages = ['dashboard', 'plugins', 'wpfunnels_page_wp_funnels', 'wpfunnels_page_edit_funnel', 'wp-funnels_page_wpfnl_settings']; $current_date_time = current_time('timestamp'); if (!in_array($screen->id, $promotional_notice_pages)) { return; } if ($current_date_time < $this->start_date || $current_date_time > $this->end_date) { return; } // Calculate the time remaining in seconds $time_remaining = $this->end_date - $current_date_time; $countdown = $this->wpf_get_promotion_banner_countdown(); ?>